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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -