Vba Code to disable Unhide option in menubar

jagdish_patel

New Member
Joined
Jan 11, 2020
Messages
14
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I am very new to get help from mrexcel.com
I want to disable Unhide option of Menubar. i got the following code for that but it is not working for me

Dim WBname As Window
Set WBname = Windows("Accounting.xlsm") 'You can use Windows("[Workbook Name]") as well
Application.CommandBars("Insert").Controls(4).Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("Format").Controls("Sheet").Controls("Unhide...").Enabled = False

even after above code unhide option is not disabled. anybody can see that window.
where i am wrong. or what is correct code.

I would be very much grateful, please anybody can help me.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I never tried that
I will check that too
But then I have to do that on each computer in our office
So I want to hide through vba

No. Just add this code to your workbook in the ThisWorkbook Module:
VBA Code:
Private Sub Workbook_Open()
     Me.IsAddin = True
     Me.Save
End Sub

Or simply, without any code, set the IsAddin Property in the VBE properties window and save once.
 
Upvote 0
after entering the following code, I am not able to open my macro file

Private Sub Workbook_Open()
Me.IsAddin = True
Me.Save
End Sub

it says, file format may be change or corrupted.
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,472
Members
449,087
Latest member
RExcelSearch

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