我目前有一张电子表格,可以使用下面的方法创建和销毁许多按钮。 123456表示我想使用“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
这很有效。问题在于我希望VIEW_SO根据销售数量改变其行为。有没有办法在例程中获取按钮名称或标题?以下是我想要做的事情:
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)
感谢任何帮助。
答案 0 :(得分:4)
Application.Caller
会为您提供按钮的名称