Variable Initialization
There are 2 ways to make variable accessable to other procedure. One is to
declare the variable globally. While this seems like a good way to go you can
end up with a project that is very difficult to maintain. A better way to
make a variable accessabel to another procedure is to pass it to that
procedure.
1 - Global Example
dim str as string
sub MainStuff()
str = "this"
call OtherStuff
end sub
sub OtherStuff
str = str & " and that"
msgbox str
end sub
2 - Passing Example
sub MainStuff()
dim str as string
str = "this"
call OtherStuff(str)
end sub
sub OtherStuff(byval str as string)
str = str & " and that"
msgbox str
end sub
--
HTH...
Jim Thomlinson
" wrote:
Hi,
What is the procedure to initliaze a variable as soon as the a macro
is invoked. The variable and its value, thus initialized, needs to be
accessible to other macros and procedures being executed in sequence
thereafter.
Thanks.
|