workbooks keep hiding

  • Thread starter Thread starter mr.davidmorrison
  • Start date Start date
M

mr.davidmorrison

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
 
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
 

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