ChrisBurch
IS-IT--Management
On my Workbook_BeforeClose I have the following code. This works as anticipated, except that I don't get the formulaBar or statusBar back.
If I put this code in a module and run it, it works fine. But if I call that same sub from the Workbook_beforeClose, I get the same problem with the 2 bars.
Has anyone any ideas?
Thanks, Chris
excel 97
Private Sub Workbook_BeforeClose(cancel As Boolean)
Dim my_val As Boolean
my_val = Sheet1.Cells(15, 52).Value 'Init val is -1 (true), set to 0 from button
cancel = my_val
If cancel = True Then 'stops close from close control
Exit Sub
Else 'My_Exit button has been pushed
With Application
.DisplayFormulaBar = True
.DisplayStatusBar = True
.AskToUpdateLinks = True
.DisplayCommentIndicator = 1
.DisplayFormulaBar = True
.DisplayStatusBar = True
End With
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
.DisplayOutline = True
.DisplayHorizontalScrollBar = True
.DisplayWorkbookTabs = True
End With
EnableAllShortcutMenus 'Enable various command bars
Application.Quit
End If
End Sub Chris
It worked yesterday.
It doesn't work today.
That's Windows!
If I put this code in a module and run it, it works fine. But if I call that same sub from the Workbook_beforeClose, I get the same problem with the 2 bars.
Has anyone any ideas?
Thanks, Chris
excel 97
Private Sub Workbook_BeforeClose(cancel As Boolean)
Dim my_val As Boolean
my_val = Sheet1.Cells(15, 52).Value 'Init val is -1 (true), set to 0 from button
cancel = my_val
If cancel = True Then 'stops close from close control
Exit Sub
Else 'My_Exit button has been pushed
With Application
.DisplayFormulaBar = True
.DisplayStatusBar = True
.AskToUpdateLinks = True
.DisplayCommentIndicator = 1
.DisplayFormulaBar = True
.DisplayStatusBar = True
End With
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
.DisplayOutline = True
.DisplayHorizontalScrollBar = True
.DisplayWorkbookTabs = True
End With
EnableAllShortcutMenus 'Enable various command bars
Application.Quit
End If
End Sub Chris
It worked yesterday.
It doesn't work today.
That's Windows!