PDA

View Full Version : Solved: Parameter passing with Command Button



JKwan
05-28-2007, 07:10 AM
I created a Meue Bar with the following button:

With bar.Controls.Add(Type:=msoControlButton)
.FaceId = 384
.Caption = "Get Stock Quotes"
.Style = msoButtonIconAndCaption
.OnAction = "GetStockData" & " False" <----- Problem here
End With


Now, I started to monkey around with the Procedural call. I wanted to pass in an Optional parameter of Boolean type. Of course, it is not working very well. What is the syntax? Is this possible with the Command Bar?

Thanks

Bob Phillips
05-28-2007, 07:37 AM
With bar.Controls.Add(Type:=msoControlButton)
.FaceId = 384
.Caption = "Get Stock Quotes"
.Style = msoButtonIconAndCaption
.OnAction = "'GetStockData False'"
End With

JKwan
05-28-2007, 07:42 AM
Thank you for the tip. I tried putting in the single quote but I never thought of putting them around the entire string..... Urgh.

Bob Phillips
05-28-2007, 07:48 AM
You can also pass strings, and multiple values.



.OnAction = "'GetStockData ""Bob"",12'"