LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help reqd with adding menu items!!


Hi yall,

I am using vba in Excel 2002. I have code to add a top level menu to
to the worksheet menu bar and two sub menu items under that - works
fine. What I cant figure out is how to check for the existence of this
menu before installing it on open. So every time this workbook is
opening, it will look on the worksheet menu bar for a menu called
"Tools" and if it is found, exit sub otherwise it will install it for
the user.

Many thanks in advance for any help offered.

Kr, Kinny.

Code creating menu items:

Sub test()

Set myMenuBar = CommandBars("Worksheet Menu Bar")

Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "Tools"

Set ctrl1 = newMenu.Controls _
..Add(Type:=msoControlButton, ID:=1)
With ctrl1
..Caption = "Report Formatter"
..TooltipText = "Format Reports Automatically"
..Style = msoButtonCaption
..FaceId = 2
..OnAction = "StartFormatting"
End With

Set ctrl2 = newMenu.Controls _
..Add(Type:=msoControlButton, ID:=2)
With ctrl2
..Caption = "Report Builder"
..TooltipText = "Creates reports from SAS data source"
..Style = msoButtonCaption
..FaceId = 2
..OnAction = "open_Report_Builder"
End With

End Sub


--
kinny
------------------------------------------------------------------------
kinny's Profile: http://www.excelforum.com/member.php...o&userid=33899
View this thread: http://www.excelforum.com/showthread...hreadid=536737

 
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
Adding menu items Claud Balls Excel Programming 2 January 19th 05 03:54 AM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
adding shortcut menu items singincpa[_2_] Excel Programming 2 October 29th 04 07:36 PM
adding shortcut menu items singincpa Excel Programming 2 October 29th 04 03:24 PM
Adding and Removing Custom Menu Items for one file... Jon Kane Excel Programming 2 September 17th 03 07:23 PM


All times are GMT +1. The time now is 08:15 AM.

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

About Us

"It's about Microsoft Excel"