Article ID: 141784
Article Last Modified on 10/11/2006
If you need to write a macro which behaves differently based on whether it is called from a button or a menu item, you should specify an argument for the macro in the Assign Macro To Object... dialog box.
Sub MultiUse(fromMenu As Boolean)
If fromMenu Then
MsgBox "Called from a menu"
Else
MsgBox "Called from a button"
End If
End Sub
'MultiUse true'
'MultiUse false'
test(1)
Caller Property
Additional query words: help file XL
Keywords: kbinfo kbcode KB141784