olikershaw
New Member
- Joined
- May 4, 2023
- Messages
- 17
- Office Version
- 2016
- Platform
- Windows
Hi All
New to posting on this forum but have used it a lot in the past for assistance.
I have a excel database with a userform which works perfectly but when I close the userform it closes all instances of excel that are open. If excel is not open it works perfectly
Here is the code for workbook open and then workbook close
Can any one help
New to posting on this forum but have used it a lot in the past for assistance.
I have a excel database with a userform which works perfectly but when I close the userform it closes all instances of excel that are open. If excel is not open it works perfectly
Here is the code for workbook open and then workbook close
VBA Code:
Private Sub Workbook_Open()
Application.Visible = False
If ThisWorkbook.ReadOnly Then
MsgBox "This program is already in use, please try again in a few minutes.", vbInformation
ThisWorkbook.Close savechanges:=False
Else
Application.Visible = False
Fault_Reporting.Show
End If
End Sub
Private Sub CommandButton12_Click()
answer = MsgBox("Are you sure you want to exit?", vbYesNo + vbQuestion + vbDefaultButton2, "Warning")
If answer = vbNo Then Exit Sub
Unload Me
ThisWorkbook.Save
Application.Quit
End Sub
Can any one help
Last edited by a moderator: