I have written a small programm that consists of several userforms that are being called by each other. That means that if I press a button on Userform A, this Userform A closes and Userform B appears, and so on.
They all read and write Data from a Excel file.
My goal is it, since it should be a "independent" program, that the customer/user of that UserformSeries does not touch this Excel file and everything is done via the Userforms.
That`s why I have already programmed that when opening the Excel file, the first "home" userform appears and the Excel file is minimized.
I would like to save and close the workbook. And then I would like to close the excel application
somehow Application.Quit does not work properly (Excel application does not close)
Do you have an idea how to close the appilcation
Thanks in advance Yours Jonas
CodePudding user response:
In the absence of any line of code displayed by you. I imagined a small example for you. See Step 1 & Step 2 and try to do it with your VBA code and let me know..
Private Sub cmdLeaveExcel_Click()
'UserForm_initialize
Unload ufMyActiveUserForm
Application.Quit 'quit Excel --> Step 1
ActiveWorkbook.Close SaveChanges:=True 'Close the active Excel workbook. --> Step 2
End Sub
CodePudding user response:
To each of the UserForms, add a Close button that in addition to closing the form also saves and closes the workbook.
