J
JK
In an attempt to mimic Print Preview, when some of my worksheets are
activated they display a limited toobar and hide the tabs. This works.
When they are deactivated, they restore the toolbar and show the tabs.
However, sometimes (not always) they don't show the tabs. Which is remedied
only by activating the worksheet again then deactivating it again.
Here's my procedure
Sub ClosePreview()
Application.ScreenUpdating = False
With ActiveSheet
.Unprotect "password"
.Visible = False
End With
Call ActivateRecordName 'RESTORES SHEET THAT WAS ACTIVE WHEN PREVIEW WAS
CALLED
Call MakeMenuBar3 'RESTORES PROGRAM'S TOOLBAR
Application.ScreenUpdating = True
ActiveWorkbook.Protect "password", Structure:=True, Windows:=False
Call KeepTabs
End Sub
Sub KeepTabs()
'PREVENTS TABS FROM DISAPPEARING
On Error GoTo ResetEvents
Application.EnableEvents = False
ActiveWindow.DisplayWorkbookTabs = True
Application.EnableEvents = True
Exit Sub
ResetEvents:
Application.EnableEvents = True
End Sub
Can anyone see what I might be doing wrong? Thank you in advance.
Jim Kobzeff
activated they display a limited toobar and hide the tabs. This works.
When they are deactivated, they restore the toolbar and show the tabs.
However, sometimes (not always) they don't show the tabs. Which is remedied
only by activating the worksheet again then deactivating it again.
Here's my procedure
Sub ClosePreview()
Application.ScreenUpdating = False
With ActiveSheet
.Unprotect "password"
.Visible = False
End With
Call ActivateRecordName 'RESTORES SHEET THAT WAS ACTIVE WHEN PREVIEW WAS
CALLED
Call MakeMenuBar3 'RESTORES PROGRAM'S TOOLBAR
Application.ScreenUpdating = True
ActiveWorkbook.Protect "password", Structure:=True, Windows:=False
Call KeepTabs
End Sub
Sub KeepTabs()
'PREVENTS TABS FROM DISAPPEARING
On Error GoTo ResetEvents
Application.EnableEvents = False
ActiveWindow.DisplayWorkbookTabs = True
Application.EnableEvents = True
Exit Sub
ResetEvents:
Application.EnableEvents = True
End Sub
Can anyone see what I might be doing wrong? Thank you in advance.
Jim Kobzeff