Reputation: 1199
I currently have a spread sheet that creates and destroys a number of buttons using the method below. 123456 represents a sales order that I would like to look up using "VIEW_SO"
Dim btn As Button
Set btn = ws.Buttons.Add(cell.left, cell.top , cell.width, cell.height)
With btn
.OnAction = "VIEW_SO"
.caption = "SO=123456"
.name = "SO123456"
End With
This works great. The problem lies in what I want VIEW_SO to change its behavior based on the sales number. Is there a way to get the button name or caption within the routine? Below is what I want to do:
Public Sub View_SO (CAPTION as String)
'I need to extract 123456 based on which button exists and pass
' it to the subroutine
v = split(CAPTION,"=",2)
'Go do stuff with v(1)
Any help is appreciated.
Upvotes: 0
Views: 1902