Close Workbook on Userform Close

Tagada -  
Willzac Posted messages 281 Status Membre -
Hello everyone,

I would like to know if it is possible to close Excel when closing a Userform (my userform is actually a kind of main menu)?
I have tried all the commands such as
ActiveWorkbook.Save
.Close
Application.Quit
etc...
But none have really closed the workbook because when we do that, other users will still see the workbook in read-only mode if they try to open it. Moreover, in the task manager, Excel is still running...
Do you have a solution?

Thank you!

Configuration: Android / Chrome 67.0.3396.87

1 réponse

f894009 Posted messages 17417 Registration date   Status Membre Last intervention   1 717
 
Hello,
closing with save
ActiveWorkbook.Close True
0
Tagada
 
Hi! I've tried already, but as I was saying, the Excel .exe application keeps running. Moreover, other users still see the document as occupied and have to open it in Read only (which clearly indicates there's a problem).
0
Patrice33740 Posted messages 8400 Registration date   Status Membre Last intervention   1 781
 
Hello,
Try instead:
Private Sub Workbook_Open() Application.WindowState = xlMinimized Application.Visible = False MenuPrincipal.Show ThisWorkbook.Save DoEvents Application.Quit End Sub

And delete:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) .... 
1