Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Custom Menu return to Excel Menu upon Closing

I would like to find out if there is a way to modify the following code to
restore the Excel Menu upon exiting the file.

Your help would be sincerely appreciated!

____________Code Below ________________________

Private Sub CommandButton1_Click()

' Remove commandbars
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Custom Menu return to Excel Menu upon Closing

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = True
Next
End Sub

Placed in the ThisWorkbook module.

--
Regards,
Tom Ogilvy

"VetcalcReport" wrote in message
...
I would like to find out if there is a way to modify the following code to
restore the Excel Menu upon exiting the file.

Your help would be sincerely appreciated!

____________Code Below ________________________

Private Sub CommandButton1_Click()

' Remove commandbars
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Custom Menu return to Excel Menu upon Closing

Hi

You can use events like this in the Thisworkbook module

Private Sub Workbook_Activate()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next
End Sub

Private Sub Workbook_Deactivate()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = True
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"VetcalcReport" wrote in message ...
I would like to find out if there is a way to modify the following code to
restore the Excel Menu upon exiting the file.

Your help would be sincerely appreciated!

____________Code Below ________________________

Private Sub CommandButton1_Click()

' Remove commandbars
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next





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
excel 2007 add custom menu ILearner Excel Discussion (Misc queries) 17 April 17th 07 07:18 PM
How do I save personal menu bar settings when closing program othf1993 Setting up and Configuration of Excel 0 August 19th 06 08:41 AM
Excel 2000 Custom Menu Item Larry Bird Excel Discussion (Misc queries) 0 November 8th 05 08:25 PM
How do i save a custom footer in the excel drop down menu? JohnJ Excel Discussion (Misc queries) 4 September 20th 05 08:37 PM


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