Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Argument to Custom Menu Selection 1

Status
Not open for further replies.

bajo71

Programmer
Aug 6, 2007
135
US
Hello,

In an .xla file, I am trying to pass an argument to a subroutine via .OnAction property of CommandBars(1).Controls.Add.

This is what I have and it runs fine
With newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
.Caption = "Transpose Working Forecast"
.OnAction = "Transpose.xla!CheckSum()"
.Enabled = False
.Style = msoButtonCaption
End With

however, if I specify an argument in CheckSum(), then I get a Macros Disabled error message. With no argument specified/required it runs fine. I've tried passing a dimmed variable, hard coding using "'" around the string etc..., nothing works.

Thanks for your help

Mickey
 
What kind of argument would you like to pass? There are ways to pass it in other way, for instance work with 'Selection' object or display a dialog from the called procedure.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top