What's wrong with my procedure to show tabs?

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
 
R

Rowan

Just a guess:

Maybe you should call KeepTabs before you protect the Workbook.

Regards
Rowan
 

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

Top