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: 270
Default Custom Menu

Have a workbook that creates a custom menu when the file is opened; if a user
opens another version of this same workbook, it deletes the menu already
there and recreates it again, to ensure the menu is only on the toolbar once
regardless of the # of workbooks open. Problem is that if I open File#1 and
then File#2, then close File#1, when I use the custom menu to do something,
it re-opens File#1, as if Excel thinks the macros called by the menu still
reside in File#1. I need it to look for the macros in the active workbook.
Have tried numerous things to fix this, but to no avail. The following sub
is called when the workbook is opened:

Sub CreateScheduleMenu()
Dim cmbBar As CommandBar
Dim cmbControl As CommandBarControl

Application.EnableEvents = True
Application.ScreenUpdating = True

On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("Schedules").Delete
On Error GoTo 0

With ActiveWorkbook
Set cmbBar = Application.CommandBars("Worksheet Menu Bar")
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlPopup, temporary:=True)

With cmbControl
.Caption = "Schedules"
With .Controls.Add(msoControlPopup)
.Caption = "For NCC/Pricer Use Only"
With .Controls.Add(msoControlPopup)
With .Controls.Add(Type:=msoControlButton)
.Caption = "Import from MMS Serv Form"
.OnAction = "GetDataFromMMSForm"
.FaceId = 301
End With
End With
End With
End With
End With
End Sub







 
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
Displaying A custom menu as a popup menu diddy_david Excel Programming 5 September 22nd 07 04:40 AM
Custom Menu and Menu Items Steve[_91_] Excel Programming 4 August 16th 07 02:15 AM
Adding Sub Menu Item to Current Custom Menu Renato Excel Programming 2 December 19th 05 12:48 AM
VBA - Disappearing custom menu and custom toolbar Peter[_50_] Excel Programming 2 December 2nd 04 06:09 PM
Custom Menu return to Excel Menu upon Closing VetcalcReport Excel Programming 2 August 2nd 04 02:59 PM


All times are GMT +1. The time now is 06:10 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"