View Full Version : Passing Variable with .OnAction
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
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.
Here is an article by Tushar Mehta:
http://www.tushar-mehta.com/excel/vba/xl%20objects%20and%20procedures%20with%20arguments.htm
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
Here is an article by Tushar Mehta:
http://www.tushar-mehta.com/excel/vba/xl%20objects%20and%20procedures%20with%20arguments.htm
Thanks.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.