ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB code changed Excel settings for all worksheets (https://www.excelbanter.com/excel-programming/325447-vbulletin-code-changed-excel-settings-all-worksheets.html)

JenniferMc

VB code changed Excel settings for all worksheets
 
I used the following vb code in a file to disable a the menu items. Now
every time I open Excel the Menu is not there.
Green around the gills with vb. What did I do wrong?

Application.CommandBars.("Worksheet Menu Bar").Enabled = False

Ron de Bruin

VB code changed Excel settings for all worksheets
 
Hi JenniferMc

Open Excel
Alt-F11
Insert module
Paste the sub
Alt-Q

Alt-F8
Select test
Run

Sub test()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
End Sub



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



"JenniferMc" wrote in message ...
I used the following vb code in a file to disable a the menu items. Now
every time I open Excel the Menu is not there.
Green around the gills with vb. What did I do wrong?

Application.CommandBars.("Worksheet Menu Bar").Enabled = False




Paul

VB code changed Excel settings for all worksheets
 


"JenniferMc" wrote:

I used the following vb code in a file to disable a the menu items. Now
every time I open Excel the Menu is not there.
Green around the gills with vb. What did I do wrong?

Application.CommandBars.("Worksheet Menu Bar").Enabled = False


I learned the hard way that those code lines become the ongoing defaults for
Excel. I cured it by running a macro wherein the codes end in "=True". The
problem is that any users that you gave your macros to now have the same
problem of a missing menu. You'll have to send them the repair macro.

Regards
Paul



JenniferMc

VB code changed Excel settings for all worksheets
 
Can this code run when the document is closed so that only the specific
workbook is impacted?

"Ron de Bruin" wrote:

Hi JenniferMc

Open Excel
Alt-F11
Insert module
Paste the sub
Alt-Q

Alt-F8
Select test
Run

Sub test()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
End Sub



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



"JenniferMc" wrote in message ...
I used the following vb code in a file to disable a the menu items. Now
every time I open Excel the Menu is not there.
Green around the gills with vb. What did I do wrong?

Application.CommandBars.("Worksheet Menu Bar").Enabled = False





Ron de Bruin

VB code changed Excel settings for all worksheets
 
Sure

Use this events in the thisworkbook module

Private Sub Workbook_Activate()
Application.CommandBars("Worksheet Menu Bar").Enabled = False
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
End Sub


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



"JenniferMc" wrote in message ...
Can this code run when the document is closed so that only the specific
workbook is impacted?

"Ron de Bruin" wrote:

Hi JenniferMc

Open Excel
Alt-F11
Insert module
Paste the sub
Alt-Q

Alt-F8
Select test
Run

Sub test()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
End Sub



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



"JenniferMc" wrote in message ...
I used the following vb code in a file to disable a the menu items. Now
every time I open Excel the Menu is not there.
Green around the gills with vb. What did I do wrong?

Application.CommandBars.("Worksheet Menu Bar").Enabled = False








All times are GMT +1. The time now is 04:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com