PDA

View Full Version : Passing Variable with .OnAction



Opv
07-13-2010, 11:11 AM
Can someone please advise if there is a way to pass a variable with the .OnAction line? The following does not seem to work.


With .Controls.Add(Type:=msoControlButton)
.Caption = "Auction View"
.FaceId = 384
.OnAction = "createView(""auctionView"")"
.Width = myIconWidth

GTO
07-13-2010, 01:44 PM
Presuming that "Auction View" is a string, not tested, try:

.OnAction = "'createView ""auctionView""'"

Please carefully note that there are single quotes on the inner-side of the outermost double-quotes.

GTO
07-13-2010, 01:48 PM
Here is an article by Tushar Mehta:

http://www.tushar-mehta.com/excel/vba/xl%20objects%20and%20procedures%20with%20arguments.htm

Opv
07-13-2010, 01:57 PM
Presuming that "Auction View" is a string, not tested, try:

.OnAction = "'createView ""auctionView""'"
Please carefully note that there are single quotes on the inner-side of the outermost double-quotes.
Thanks. That seems to have done the trick...at last as far as I can tell now. At least it's calling the appropriate subroutine. Still got a problem with functionality in that sub but I think I can tinker with it and get it working right. I'm going to leave this thread open for now just in case I run into a snag.

Thanks again,

Opv

Opv
07-13-2010, 01:58 PM
Here is an article by Tushar Mehta:

http://www.tushar-mehta.com/excel/vba/xl%20objects%20and%20procedures%20with%20arguments.htm

Thanks.