excel - Calling a sub and passing an argument in VBA -
i'm trying call sub (onaction) , passing argument toolbar control, cannot seem call keep getting "cannot run macro. macro may not available".
the control in workbook , function in module.
option explicit sub somefunction(optional servertype string) end sub
here's code control:
with toolsmenucontrol .caption = "some caption" .onaction = "'" & thisworkbook.name & "'!somefunction ""wintel""'" .tag = c_tag end
please advice.
it seems correct .onaction property
assignment depends on whether file saved or not. therefore there possible syntax presented below:
if thisworkbook.saved 'when file saved .onaction = "'" & thisworkbook.name & "'!'somefunction ""saved""'" else 'when file not saved .onaction = thisworkbook.name & "!'somefunction ""not saved""'" end if
Comments
Post a Comment