OnAction help needed...
Posted by Dank on October 05, 2001 5:37 AM
This is the code that I'm currently using:-
Private Sub AddBar()
'Add a command button to the worksheet menu bar
Dim Combar As CommandBar
Dim Combut As CommandBarButton
Set Combar = Application.CommandBars("Worksheet Menu Bar")
Set Combut = Combar.Controls.Add(msoControlButton)
Combut.Style = msoButtonCaption
Combut.Caption = "&Transaction Report"
Combut.OnAction = "RunReport"
I want to be able to pass an integer argument to the procedure RunReport but don't know how. Does anyone? RunReport(1) or RunReport 1 don't work because VBA thinks that is the full macro name.