excel - Optional argument in VBA causes error while executing -
this question has answer here:
i tried create procedure passes 2 arguments, mandatory , optional, before added optional argument procedure running correctly. here code:
sub a2(var string, optional num integer = 5) msgbox (num) end sub sub start_a2() a2 ("null_text", 5) end sub
when pass second argument, running procedure start_a2 fails @ 1st line: sub start_a2(), vba higlight line yellow , returns syntax error, not provide details. second argument inproperely passed?
does work if use call
? such
sub start_a2() call a2("null_text", 5) end sub
edit: though above work, @so's comment below right on (thanks!); can use
sub start_a2() a2 "null_text", 5 end sub
Comments
Post a Comment