A
Amdi
Hi
I can't use references in my VBA code, so instead I use Application.Run to
call subs and functions in my global addin.
But when I do that, I cant use 'optional' in my sub/function.
Ex.
Sub CallMe (Byval Arg1 as string, Optional Byval Arg2 as string = "Local
Arg2", Optional Byval Arg3 as string = "Local Arg3"
Debug.print Arg1, Arg2, Arg3
End sub
Calling the sub with CallMe "Arg1", , "Arg3" would result in "Arg1", "Local
Arg2", "Arg3", just as expected.
Calling the sub using Application.Run "CallMe", "Arg1", "Arg2" results in
"Arg1", "Arg2", "Local Arg3".
But when I call the sub using Application.Run "CallMe", "Arg1", , "Arg3" I
get the result "Arg1", "Local Arg2", "Local Arg3".
Why is the sub ignoring the third parameter, and instead using the local
data, when i skip the second parameter??
I’m using Office 2003
Thanks in advance
Jan Amdi letvad
I can't use references in my VBA code, so instead I use Application.Run to
call subs and functions in my global addin.
But when I do that, I cant use 'optional' in my sub/function.
Ex.
Sub CallMe (Byval Arg1 as string, Optional Byval Arg2 as string = "Local
Arg2", Optional Byval Arg3 as string = "Local Arg3"
Debug.print Arg1, Arg2, Arg3
End sub
Calling the sub with CallMe "Arg1", , "Arg3" would result in "Arg1", "Local
Arg2", "Arg3", just as expected.
Calling the sub using Application.Run "CallMe", "Arg1", "Arg2" results in
"Arg1", "Arg2", "Local Arg3".
But when I call the sub using Application.Run "CallMe", "Arg1", , "Arg3" I
get the result "Arg1", "Local Arg2", "Local Arg3".
Why is the sub ignoring the third parameter, and instead using the local
data, when i skip the second parameter??
I’m using Office 2003
Thanks in advance
Jan Amdi letvad