A
Andibevan
I have created a command bar and added 1 button as follows:-
Set myBar = CommandBars.Add(, position:=msoBarPopup, Temporary:=True)
Set CTRL_Test = myBar.Controls.Add(Type:=msoControlButton)
I want the button to call a sub with an argument, the sub is as follows
Public Sub testercmd(nn As Variant)
MsgBox nn
End Sub
I am trying to set the onaction as follows, but every combination of quotes
and brackets doesn't work? Can you call a sub with arguments in this way or
can you only call functions with arguments from onaction?
I am currently trying as follows:-
With CTRL_Test
.Caption = "Test Button"
.OnAction = "'testercmd ""12""'"
End With
TIA
Andi
Set myBar = CommandBars.Add(, position:=msoBarPopup, Temporary:=True)
Set CTRL_Test = myBar.Controls.Add(Type:=msoControlButton)
I want the button to call a sub with an argument, the sub is as follows
Public Sub testercmd(nn As Variant)
MsgBox nn
End Sub
I am trying to set the onaction as follows, but every combination of quotes
and brackets doesn't work? Can you call a sub with arguments in this way or
can you only call functions with arguments from onaction?
I am currently trying as follows:-
With CTRL_Test
.Caption = "Test Button"
.OnAction = "'testercmd ""12""'"
End With
TIA
Andi