excel - Optional argument in VBA causes error while executing -


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

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -