Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default VB - Macro to list all controls in the Commandbar.

Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.

Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VB - Macro to list all controls in the Commandbar.


Install this add-in
http://www.erlandsendata.no/english/...oadcommandbars




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"LABKHAND" wrote in message ...
Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.

Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VB - Macro to list all controls in the Commandbar.

The name is
CommandBar Tools



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Ron de Bruin" wrote in message ...

Install this add-in
http://www.erlandsendata.no/english/...oadcommandbars




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"LABKHAND" wrote in message ...
Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.

Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default VB - Macro to list all controls in the Commandbar.

Ron,

Can not use any ADD-ins since i need to further manipulate and write my own
code...

"Ron de Bruin" wrote:


Install this add-in
http://www.erlandsendata.no/english/...oadcommandbars




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"LABKHAND" wrote in message ...
Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.

Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default VB - Macro to list all controls in the Commandbar.

Hi,

Try this

Sub MenuOptions()
Dim ctrl As CommandBarControl
Dim MenOption As CommandBarControl
Dim rw As Long
rw = 2
For Each ctrl In Application.CommandBars("Worksheet Menu Bar").Controls
Sheets("Command Bars").Cells(rw, "B") = _
WorksheetFunction.Substitute(ctrl.Caption, "&", "")
rw = rw + 1
For Each MenOption In ctrl.Controls
Cells(rw, "B").HorizontalAlignment = xlRight
Sheets("Command Bars").Cells(rw, "B") = _
WorksheetFunction.Substitute(MenOption.Caption, "&", "")
rw = rw + 1
Next
Next ctrl
End Sub

Mike

"LABKHAND" wrote:

Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.

Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default VB - Macro to list all controls in the Commandbar.

Mike,

Thanks for your help. I need to do further processing and data manupulation
after I get names of all controls under my custom menu. so if my custom
menu on the "Worksheet Menu Bar" is called "A" and this menu has a button
called "B" and a submenu called "C". furthe rmore there are more controls
on the submenu "C"...
so as you see this linkage can be very long and I need to trace this linkage
all the way in order to have all the control names.

So your code does not help me. I need to trace the controls linkage in my
cutom menu to get all names.


"Mike H" wrote:

Hi,

Try this

Sub MenuOptions()
Dim ctrl As CommandBarControl
Dim MenOption As CommandBarControl
Dim rw As Long
rw = 2
For Each ctrl In Application.CommandBars("Worksheet Menu Bar").Controls
Sheets("Command Bars").Cells(rw, "B") = _
WorksheetFunction.Substitute(ctrl.Caption, "&", "")
rw = rw + 1
For Each MenOption In ctrl.Controls
Cells(rw, "B").HorizontalAlignment = xlRight
Sheets("Command Bars").Cells(rw, "B") = _
WorksheetFunction.Substitute(MenOption.Caption, "&", "")
rw = rw + 1
Next
Next ctrl
End Sub

Mike

"LABKHAND" wrote:

Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.

Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default VB - Macro to list all controls in the Commandbar.

So that it is easier to see what i am doing...the following code gets me to
the level 2 of the menus:

Dim cbarMenu As CommandBar
Dim cbarControl As CommandBarControl
Dim aa As CommandBarControl
Dim controlname As String

controlname = "Format"
Set cbarMenu = CommandBars("Worksheet Menu Bar")

MsgBox cbarMenu.Controls(controlname).Controls.Count

For Each cbarControl In cbarMenu.Controls(controlname).Controls
MsgBox cbarControl.Caption

Set aa = CommandBarsControl(cbarControl.Caption)
Next


I need to change this code so that it is recursive and goes through all
levels of controls under my custom menu. I am having a tough time getting
that info!



"Mike H" wrote:

Hi,

Try this

Sub MenuOptions()
Dim ctrl As CommandBarControl
Dim MenOption As CommandBarControl
Dim rw As Long
rw = 2
For Each ctrl In Application.CommandBars("Worksheet Menu Bar").Controls
Sheets("Command Bars").Cells(rw, "B") = _
WorksheetFunction.Substitute(ctrl.Caption, "&", "")
rw = rw + 1
For Each MenOption In ctrl.Controls
Cells(rw, "B").HorizontalAlignment = xlRight
Sheets("Command Bars").Cells(rw, "B") = _
WorksheetFunction.Substitute(MenOption.Caption, "&", "")
rw = rw + 1
Next
Next ctrl
End Sub

Mike

"LABKHAND" wrote:

Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.

Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default VB - Macro to list all controls in the Commandbar.


Download my "Custom Menu Items Only" workbook from...
http://excelusergroup.org/media/
The project is unlocked.
--
Jim Cone
Portland, Oregon USA





"LABKHAND"

wrote in message
Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.
Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default VB - Macro to list all controls in the Commandbar.

Thanks all for your quick response....I figured it out some other way. Good
day.

"LABKHAND" wrote:

Hi All,

Through VB code, I have added a new custom menu to the Commandbar("Worksheet
Menu Bar"). This custom menu has several controls (menus/submenus). I am
trying to write a VB macro that gets me name of each control (menu/submenus)
in this custom menu item. Any help would be appreciated.

Thx


I am trying to write a vb code to list name of all Excel commandbars and
their associated controls (menus/submenus). For example I have created a
custom menu in Excel with several sub-menus in it. I need to get name of
each control in this custom menu item in the "WorkSheet Menu Bar".

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting CommandBar("").Controls [email protected] Excel Programming 3 January 9th 08 02:20 AM
How to assign keyboard shortcut to existing Commandbar controls superjas Excel Programming 2 June 19th 06 08:24 AM
Password on Commandbar menu list JB2005 Excel Programming 2 August 24th 05 08:10 AM
CommandBar Controls Simon Shaw[_5_] Excel Programming 3 December 28th 04 05:05 PM


All times are GMT +1. The time now is 11:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"