ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook_close (https://www.excelbanter.com/excel-programming/429146-workbook_close.html)

Martin

Workbook_close
 
Hi,

I have the code posted below that on the close workbook event it replaces
the toolbars, gridlines etc. that I remove on the workbook_open event.
However the only line that doesnt seem to work properly is the
"Application.DisplayFormulaBar = True".

When I close the workbook I never get my formula bar back and I have to go
to options to reset.

Can anyone help me in understanding why this is?

Many thanks in advance.

Martin

Here is the code:

Sub Workbook_close()

Sheets("Main Menu").Activate
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
.DisplayWorkbookTabs = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
End With

Application.DisplayFormulaBar = True

Application.CommandBars("Worksheet Menu Bar").Enabled = True
Application.CommandBars("Standard").Enabled = True
Application.CommandBars("Reviewing").Enabled = True
Application.CommandBars("Formatting").Enabled = True
Application.CommandBars("Drawing").Enabled = True
Application.CommandBars("Chart").Enabled = True
Application.CommandBars("Control Toolbox").Enabled = True

End Sub

JLGWhiz[_2_]

Workbook_close
 
The only thing I can think of is timing. You might try a delay after or
before the execution line. Or, move that line to the beginning of the
macro.


"Martin" wrote in message
...
Hi,

I have the code posted below that on the close workbook event it replaces
the toolbars, gridlines etc. that I remove on the workbook_open event.
However the only line that doesnt seem to work properly is the
"Application.DisplayFormulaBar = True".

When I close the workbook I never get my formula bar back and I have to go
to options to reset.

Can anyone help me in understanding why this is?

Many thanks in advance.

Martin

Here is the code:

Sub Workbook_close()

Sheets("Main Menu").Activate
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
.DisplayWorkbookTabs = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
End With

Application.DisplayFormulaBar = True

Application.CommandBars("Worksheet Menu Bar").Enabled = True
Application.CommandBars("Standard").Enabled = True
Application.CommandBars("Reviewing").Enabled = True
Application.CommandBars("Formatting").Enabled = True
Application.CommandBars("Drawing").Enabled = True
Application.CommandBars("Chart").Enabled = True
Application.CommandBars("Control Toolbox").Enabled = True

End Sub





All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com