VBA:programmatically invoking menu items from Excel Worksheet
Get them with code
For Each ctl In Application.Commandbars("Worksheet Menu
Bar").Controls("File").Controls
Debug.Print ctl.Name, ctl.Id
Next Ctl
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"morse100" wrote in message
...
"Bob Phillips" wrote:
You need to get the controls id, and then execute it like so
Application.VBE.CommandBars.FindControl(ID:=ctl_id ).Execute
Sheet delete is 847.
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my
addy)
"morse100" wrote in message
...
I would like to to be able invoke specified menu items from the standard
Excel WorkSheet menu bar from within VBA subroutines and functions (do
***not*** need to change the resulting behaviour in any way
whatsoever).
For example
Edit | Delete Sheet
But I have absolutely no idea how to access the equivalent OnAction
macro,
or indeed to discover its name.
Any and all help will be much appreciated
many thanks
morse
Hello,
many thanks for the quick and very helpful reply. I would be grateful if
you could point me at a source for other Control-Ids like the one you
specified.
Best wishes
Morse
|