Click to See Complete Forum and Search --> : Getting list of Menu/Items at runtime


Trevor Lewis
August 1st, 2001, 11:09 AM
Is it possible to get a list of the menu options I have defined in my program at runtime.

Cimperiali
August 1st, 2001, 11:25 AM
option Explicit

private Sub Command1_Click()
Dim ctl as Control
for Each ctl In me.Controls
If TypeOf ctl is Menu then
Debug.print ctl.Name
Debug.print ctl.Caption

End If
next
End Sub





Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright,Bruno Paris
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater

Clearcode
August 1st, 2001, 11:26 AM
You could use the EventVB.dll - it has an ApiMenu object that you can enumerate through programatically...see:
http://www.merrioncomputing.com/EventVB/ApiMenu_Submenus.html

HTH,
Duncan

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.

Trevor Lewis
August 2nd, 2001, 03:12 AM
Many Thanks