ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Execute My Code on Menu Option (https://www.excelbanter.com/excel-programming/415965-execute-my-code-menu-option.html)

Mike H.

Execute My Code on Menu Option
 
Application.VBE.CommandBars.FindControl(ID:=2188). Execute

If I wish to execute my own function when the user selects the option:
FileSend toMail Receipient (as attachment)... the Correct ID # is 2188,
but how do I tell it to run "MySub" instead? The above line gives me an
error # 1004. Perhaps the OnAction will work, but I don't understand the
syntax for it. Thanks.

Héctor Miguel

Execute My Code on Menu Option
 
hi, Mike !

Application.VBE.CommandBars.FindControl(ID:=2188). Execute
If I wish to execute my own function when the user selects the option:
FileSend toMail Receipient (as attachment)... the Correct ID # is 2188
but how do I tell it to run "MySub" instead?
The above line gives me an error # 1004.
Perhaps the OnAction will work, but I don't understand the syntax for it...


you probably need to use a class module, see this thread: http://tinyurl.com/6po44f

hth,
hector.



Mike H.

Execute My Code on Menu Option
 
I got it to work. Thanks!

"Héctor Miguel" wrote:

hi, Mike !

Application.VBE.CommandBars.FindControl(ID:=2188). Execute
If I wish to execute my own function when the user selects the option:
FileSend toMail Receipient (as attachment)... the Correct ID # is 2188
but how do I tell it to run "MySub" instead?
The above line gives me an error # 1004.
Perhaps the OnAction will work, but I don't understand the syntax for it...


you probably need to use a class module, see this thread: http://tinyurl.com/6po44f

hth,
hector.





All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com