View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default How to run sub menu items from VBA

Hi,

Unless you have a compelling reason for doing it that way it's far simpler
to perform a Vb sirt like this

Range("B1:B100").Sort Key1:=Range("B1"), Order1:=xlAscending

Mike

"Mangesh" wrote:

I am trying to run a sub menu item from the toolbar through VBA. How
do i do it? Lets say for example, i want to run Data Sort.

CommandBars("Worksheet Menu Bar").Controls("Data").Index gives me the
index of menu item 'Data'. But how to get the index for Sort.

something like this is what i am looking for, although this is not
valid
CommandBars("Worksheet Menu Bar").Controls("Data").Controls("Sort")

Basically i want to automate one of the submenu actions.

Mangesh