Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Having Trouble Setting up Simple User-Defined Function
#1
Hi,

I am trying to simplify my scripts by putting an often repeated step in a function

say
Code:
Copy      Help
GetDemographics

When GetDemographics is run in the main macro script (Let's call it "mainscript"), it should call up the code in GetDemographics which will find out values for str variables a, b, c, d and e by running the script in GetDemographics.
I would like these values to be passed back to the caller script ("mainscript").

For simplicity's sake let just say

that GetDemographics code would be:



Code:
Copy      Help
a=apple
b=banana
c=canary
d=dog
e=elephant


Now, after GetDemographics is completed running, mainscript should have values for a, b, c, d, e as determined above in GetDemographics.

It seems like I should be able to do this easily but I am getting confused with variable scope (str+) i.e. do I have to define the variables locally in both caller and GetDemographcis? Do I need to define receiver variables in first line of function? Just can't seem to get it to work.

Thanks for any help....

Stuart


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)