Reloading Custom Menus

Mr Nick

Board Regular
Joined
Mar 11, 2002
Messages
95
I have a sheet which uses two custom menus that contain numerous macro buttons. In order for these macros to stay associated with the sheet after doing a 'Save As', it is necessary to delete these toolbars on deactivating the sheet, and not merely disable them. The menus are attached to the sheet so are loaded each time it is opened.

My problem is this:
If I switch between workbooks, my menus are deleted as I do not want them available in other environments, but when I switch back to my original sheet without closing and reopening, my toolbars are not reloaded.

I'm currently using the enable string to try to reactivate them but that isn't working. Is it possible to reload a deleted toolbar from within the active sheet without closing, or am I going to have to rethink my strategy?

If I delete the toolbars using the beforeclose field, if I hit close and then cancel out to return to my sheet, the toolbars are already deleted and render the sheet unusable.

The toolbar has been built using the custom toolbar builder, not coding, otherwise I would be able to rebuild the custom menu each time the sheet was activated.

Any way of doing this without having to churn out masses of code to build my menus?
This message was edited by Mr Nick on 2002-04-11 02:58
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
For anybody else who has faced this problem, I found this solution at j-walk.com

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not Me.Saved Then
Msg = "Do you want to save the changes you made to "
Msg = Msg & Me.Name & "?"
Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel)
Select Case Ans
Case vbYes
Me.Save
Case vbNo
Me.Saved = True
Case vbCancel
Cancel = True
Exit Sub
End Select
End If
Call DeleteMenu 'Change this to your own subroutine
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,513
Members
448,967
Latest member
screechyboy79

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top