ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   workbooks keep hiding (https://www.excelbanter.com/excel-discussion-misc-queries/89767-workbooks-keep-hiding.html)

[email protected]

workbooks keep hiding
 
how do you stop all the inactive workbooks from hiding I was using this
code to hide everything and now whenever I have two or more workbooks
open only the active one shows
I have the same code for workbook deactivate and activate

Private Sub Workbook_Open()
With ActiveWindow
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayWorkbookTabs = False
With Application
.DisplayFormulaBar = False
.DisplayStatusBar = False
End With

End With
Dim TBarCount As Integer
Dim cbar As CommandBar
Sheets("sheet1").Range("A:A").ClearContents
TBarCount = 0
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypeNormal Then
If cbar.Visible Then
TBarCount = TBarCount + 1
Sheets("sheet1").Cells(TBarCount, 1) = cbar.Name
cbar.Visible = False
End If
End If
Next cbar
Sheets("Information").Select
Range("A3").Select
ActiveWindow.Zoom = 95

End Sub
Private Sub Workbook_Activate()
With ActiveWindow
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayWorkbookTabs = False
With Application
.DisplayFormulaBar = False
.DisplayStatusBar = False
End With

End With
Dim TBarCount As Integer
Dim cbar As CommandBar
Sheets("sheet1").Range("A:A").ClearContents
TBarCount = 0
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypeNormal Then
If cbar.Visible Then
TBarCount = TBarCount + 1
Sheets("sheet1").Cells(TBarCount, 1) = cbar.Name
cbar.Visible = False
End If
End If
Next cbar
Sheets("Information").Select
Range("A3").Select
ActiveWindow.Zoom = 95

End Sub


curlydave

workbooks keep hiding
 
woops gave the same code
heres the code I have for
before close or deactivate

Private Sub Workbook_BeforeClose(Cancel As Boolean)
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayWorkbookTabs = True
End With

Dim Row As Long
Dim TBar As String
Row = 1
TBar = Sheets("sheet1").Cells(Row, 1)
Do While TBar < ""
Application.CommandBars(TBar).Visible = True
Row = Row + 1
TBar = Sheets("sheet1").Cells(Row, 1)
Loop

ActiveWindow.Zoom = 100
With Application
.DisplayFormulaBar = True
.DisplayStatusBar = True
End With

End Sub



All times are GMT +1. The time now is 06:16 PM.

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