View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default VBA:programmatically invoking menu items from Excel Worksheet menu

The easiest way to learn those is to use
Tools | Macro | Record New Macro
and then perform an operation and examine the code generated.

Dave McRitchie has some information about getting started in that direction
he
http://www.mvps.org/dmcritchie/excel/getstarted.htm

In some cases you'll have to modify the macro recorded to become more
generic. A good example of that came up recently: someone had recorded a
macro to format a row of a worksheet a special way. They'd started the macro
just before selecting the row to work with. So the macro recorded that part
of it and it threw them - and all they had to do was remove the line of code
that showed where they'd selected the row, and the one toward the end which
then selected a particular cell on that specific row.


"morse100" wrote:

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