CaptainGravyBum
Board Regular
- Joined
- Dec 1, 2023
- Messages
- 77
- Office Version
- 365
- Platform
- Windows
Hello,
I know this is going to be a real simple fix, but the answer is eluding me so would appreciate some help.
My excel workbook has some VBA script applied in the Workbook_BeforeClose section and when it runs, there is a message box that I need to display, but it appears twice.
I'm pretty sure it's because the message box appears on the initial close workbook is triggered and then again when the script closes the workbook to save changes, I'm hoping there is a way round this.
Code is as follows:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Cross-Charge Request").Select
Range("E4,E5,E6,B8:F10").Select
Selection.ClearContents
Range("E4").Select
MsgBox "Cross Charge Request Form Updated"
Application.DisplayAlerts = False
ThisWorkbook.Close savechanges:=True
Application.DisplayAlerts = True
End Sub
I know this is going to be a real simple fix, but the answer is eluding me so would appreciate some help.
My excel workbook has some VBA script applied in the Workbook_BeforeClose section and when it runs, there is a message box that I need to display, but it appears twice.
I'm pretty sure it's because the message box appears on the initial close workbook is triggered and then again when the script closes the workbook to save changes, I'm hoping there is a way round this.
Code is as follows:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Cross-Charge Request").Select
Range("E4,E5,E6,B8:F10").Select
Selection.ClearContents
Range("E4").Select
MsgBox "Cross Charge Request Form Updated"
Application.DisplayAlerts = False
ThisWorkbook.Close savechanges:=True
Application.DisplayAlerts = True
End Sub