ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with - J.Walkenbachs code (https://www.excelbanter.com/excel-programming/338640-help-j-walkenbachs-code.html)

Tempy

Help with - J.Walkenbachs code
 
Hi all, I got the code from J. Walkenbachs book and it works great, but
it does not hide the menu bar, could somebody tell my how i would modify
it to hide the menu bar as well ??

---------------------------------------------------------------------
Sub HideAllToolbars()
Dim TB As CommandBar
Dim TBNum As Integer
Dim TBSheet As Worksheet
Set TBSheet = Workbooks("Recon_Master.xls").Worksheets("TBSheet" )
Application.ScreenUpdating = False
' clear the sheet
TBSheet.Cells.Clear
'Hide all visable toolbars and store their names
TBNum = 0
For Each TB In CommandBars
If TB.Type = msoBarTypeNormal Then
If TB.Visible Then
TBNum = TBNum + 1
TB.Visible = False
TBSheet.Cells(TBNum, 1) = TB.Name
End If
End If
Next TB
Application.ScreenUpdating = True
addToolbar
End Sub
------------------------------------------------------------------------
-
Sub restoreToolbars()
Dim TBSheet As Worksheet
Dim cell As Range
Set TBSheet =
Workbooks("Recon_Master.xls").Worksheets("TBSheet" )
Application.ScreenUpdating = False
'unhide the previousely displayed toolbars
On Error Resume Next
For Each cell In TBSheet.Range("A:A") _
.SpecialCells(xlCellTypeConstants)
CommandBars(cell.Value).Visible = True
Next cell
Application.ScreenUpdating = True
End Sub


Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Tom Ogilvy

Help with - J.Walkenbachs code
 
application.Commandbars("Worksheet Menu Bar").Enabled = False

--
Regards,
Tom Ogilvy

"Tempy" wrote in message
...
Hi all, I got the code from J. Walkenbachs book and it works great, but
it does not hide the menu bar, could somebody tell my how i would modify
it to hide the menu bar as well ??

---------------------------------------------------------------------
Sub HideAllToolbars()
Dim TB As CommandBar
Dim TBNum As Integer
Dim TBSheet As Worksheet
Set TBSheet = Workbooks("Recon_Master.xls").Worksheets("TBSheet" )
Application.ScreenUpdating = False
' clear the sheet
TBSheet.Cells.Clear
'Hide all visable toolbars and store their names
TBNum = 0
For Each TB In CommandBars
If TB.Type = msoBarTypeNormal Then
If TB.Visible Then
TBNum = TBNum + 1
TB.Visible = False
TBSheet.Cells(TBNum, 1) = TB.Name
End If
End If
Next TB
Application.ScreenUpdating = True
addToolbar
End Sub
------------------------------------------------------------------------
-
Sub restoreToolbars()
Dim TBSheet As Worksheet
Dim cell As Range
Set TBSheet =
Workbooks("Recon_Master.xls").Worksheets("TBSheet" )
Application.ScreenUpdating = False
'unhide the previousely displayed toolbars
On Error Resume Next
For Each cell In TBSheet.Range("A:A") _
.SpecialCells(xlCellTypeConstants)
CommandBars(cell.Value).Visible = True
Next cell
Application.ScreenUpdating = True
End Sub


Tempy

*** Sent via Developersdex http://www.developersdex.com ***




Tempy

Help with - J.Walkenbachs code
 
Thanks Tom.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 10:54 AM.

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