Disable Worksheet Tab Menu

  • Thread starter Thread starter cjsmile2106
  • Start date Start date
C

cjsmile2106

Hello Everyone,

Hope someone can help me out. I'm trying to find a code out ther
that will disable the Worksheet tab menu. Also to have it onl
disabled when the workbook is open and clear itself when the workboo
closes. I guess like a Workbook_Open/Workbook_Close function. An
help out there would be great.

Thanks,
Davi
 
Found by recording a macro...

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWindow.DisplayWorkbookTabs = True
End Sub

Private Sub Workbook_Open()
ActiveWindow.DisplayWorkbookTabs = False
End Sub
 
Hi

The menu when you right click on the Arrows ?
If not use 34 for the right click on a sheet tab

Copy this in the Thisworkbook module


Private Sub Workbook_Activate()
Application.CommandBars(27).Enabled = False
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars(27).Enabled = True
End Sub
 
Oops, you want to hide it I think

Hide it in Tools>Options
It will be saved with the file this setting

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


Ron de Bruin said:
Hi

The menu when you right click on the Arrows ?
If not use 34 for the right click on a sheet tab

Copy this in the Thisworkbook module


Private Sub Workbook_Activate()
Application.CommandBars(27).Enabled = False
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars(27).Enabled = True
End Sub
 
I'd recommend using the Workbook_Activate and Workbook_Deactivate event
macros, instead of Open and BeforeClose. That way it only applies to
that workbook, even if there are multiple workbooks open in the XL
instance.
 
Thank you everyone for your assistance. I'm still having troubl
disabling the menu though. The following macro works great, but I nee
to be able to view the tabs. I need to disable the tab menu, but stil
view the tabs themselves, and I haven't been able to figure that on
out yet. Help?!?

Thank you!

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWindow.DisplayWorkbookTabs = True
End Sub

Private Sub Workbook_Open()
ActiveWindow.DisplayWorkbookTabs = False
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top