Stubborn Excel Options
Peter,
Unfortunately the results were even worse. For some reason my UserToolBars
function doesn't work correctly in the Workbook_Activate and
Workbook_Deactivate events. It doesn't fix my first problem, either.
"Peter T" wrote:
Try moving your code from the window events to the Workbook_Activate &
Workbook_Deactivate events respectively
Regards,
Peter T
"VBA_Newbie79" wrote in message
...
I have adopted some code I received from this forum to create a
personalized
toolbar, hide all menus and other toolbars, as well remove the formula
bar,
worksheet tabs, and column/row headings.
The code runs in the ThisWorkbook module in both the WindowActivate and
WindowDeactivate events. It works fine flipping between the application
and
other Excel files, but refuses to turn the formula bar, worksheet tabs,
and
column/row headings back on when I close the file.
I tried including the code in a BeforeClose event, but that doesn't make a
difference. The formula bar, worksheet tabs, and column/row headings will
only turn on via the Tools Options menu. Have I corrupted something or
is
this a "quirk" of Excel?
Below is my code:
----------------------------------------------------
Private Sub Workbook_Windowactivate(ByVal Wn As Excel.Window)
Application.ScreenUpdating = False
Call CreateMenubar
UserToolBars (xlOn)
With ActiveWindow
.DisplayWorkbookTabs = False
.DisplayHeadings = False
End With
With Application
.DisplayFormulaBar = False
.CommandBars("Worksheet Menu Bar").Enabled = False
.ScreenUpdating = True
End With
End Sub
----------------------------------------------------
Private Sub Workbook_WindowDeactivate(ByVal Wn As Excel.Window)
Application.ScreenUpdating = False
Call RemoveMenubar
UserToolBars (xlOff)
With ActiveWindow
.DisplayWorkbookTabs = True
.DisplayHeadings = True
End With
With Application
.DisplayFormulaBar = True
.CommandBars("Worksheet Menu Bar").Enabled = True
.ScreenUpdating = True
End With
End Sub
|