0

我目前有一个使用以下方法创建和销毁许多按钮的电子表格。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)

任何帮助表示赞赏。

4

1 回答 1

4

Application.Caller会给你按钮的名字

于 2013-11-05T17:39:20.010 回答