close

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(quot;sheet1quot;).Range(quot;A:Aquot;).ClearContents
TBarCount = 0
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypeNormal Then
If cbar.Visible Then
TBarCount = TBarCount 1
Sheets(quot;sheet1quot;).Cells(TBarCount, 1) = cbar.Name
cbar.Visible = False
End If
End If
Next cbar
Sheets(quot;Informationquot;).Select
Range(quot;A3quot;).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(quot;sheet1quot;).Range(quot;A:Aquot;).ClearContents
TBarCount = 0
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypeNormal Then
If cbar.Visible Then
TBarCount = TBarCount 1
Sheets(quot;sheet1quot;).Cells(TBarCount, 1) = cbar.Name
cbar.Visible = False
End If
End If
Next cbar
Sheets(quot;Informationquot;).Select
Range(quot;A3quot;).Select
ActiveWindow.Zoom = 95

End Subwoops 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(quot;sheet1quot;).Cells(Row, 1)
Do While TBar lt;gt; quot;quot;
Application.CommandBars(TBar).Visible = True
Row = Row 1
TBar = Sheets(quot;sheet1quot;).Cells(Row, 1)
Loop

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

End Sub

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()