J
Jac Tremblay
Hi everyone
I have an Excel application that is a workbook with a worksheet as frontend. When the workbook opens, the Workbook_Open event is triggered and does its job well. When the job is done, I close the application without saving changes and hopes that the Workbook_BeforeClose event will do its job too. But it does not. In debug mode, the lines of code go by but nothing happens really. I just want to restore the command bars, the formula bar and so on
I have checked the newsgroup similar problems and cannot find the problem
The code that closes the application is
' ****
Workbooks(strConstAppAlimenter).Close SaveChanges:=Fals
' ****
I tried to put this line before but it does not work either
' ****
Application.EnableEvents = Tru
' ****
Here is the code for the Workbook_BeforeClose event
' ******************************************************************
Private Sub Workbook_BeforeClose(Cancel As Boolean
Application.ScreenUpdating = Tru
Workbooks(strConstAppFeed).Activat
Range("A1").Selec
With Applicatio
.DisplayStatusBar = Tru
.StatusBar = "
.WindowState = xlNorma
.WindowState = xlNorma
.Width = 53
.Height = 53
.Left =
.Top =
End Wit
With ActiveWindo
.Width = 50
.Height = 42
.DisplayGridlines = Tru
.DisplayHeadings = Tru
.DisplayHorizontalScrollBar = Tru
.DisplayVerticalScrollBar = Tru
.DisplayWorkbookTabs = Tru
End Wit
If booCommandBarStandard The
Application.CommandBars("Standard").Visible = Tru
End I
If booCommandBarFormatting The
Application.CommandBars("Formatting").Visible = Tru
End I
Application.DisplayFormulaBar = Tru
ActiveWorkbook.Saved = Tru
End Su
' ******************************************************************
Thanks.
I have an Excel application that is a workbook with a worksheet as frontend. When the workbook opens, the Workbook_Open event is triggered and does its job well. When the job is done, I close the application without saving changes and hopes that the Workbook_BeforeClose event will do its job too. But it does not. In debug mode, the lines of code go by but nothing happens really. I just want to restore the command bars, the formula bar and so on
I have checked the newsgroup similar problems and cannot find the problem
The code that closes the application is
' ****
Workbooks(strConstAppAlimenter).Close SaveChanges:=Fals
' ****
I tried to put this line before but it does not work either
' ****
Application.EnableEvents = Tru
' ****
Here is the code for the Workbook_BeforeClose event
' ******************************************************************
Private Sub Workbook_BeforeClose(Cancel As Boolean
Application.ScreenUpdating = Tru
Workbooks(strConstAppFeed).Activat
Range("A1").Selec
With Applicatio
.DisplayStatusBar = Tru
.StatusBar = "
.WindowState = xlNorma
.WindowState = xlNorma
.Width = 53
.Height = 53
.Left =
.Top =
End Wit
With ActiveWindo
.Width = 50
.Height = 42
.DisplayGridlines = Tru
.DisplayHeadings = Tru
.DisplayHorizontalScrollBar = Tru
.DisplayVerticalScrollBar = Tru
.DisplayWorkbookTabs = Tru
End Wit
If booCommandBarStandard The
Application.CommandBars("Standard").Visible = Tru
End I
If booCommandBarFormatting The
Application.CommandBars("Formatting").Visible = Tru
End I
Application.DisplayFormulaBar = Tru
ActiveWorkbook.Saved = Tru
End Su
' ******************************************************************
Thanks.