hi I have a excel VBA Macro program which works fine in Excel 2010 or older version, but it has a problem in excel 365. in the following code, "savefile.close" works fine in excel 2010 by closing a file namely"savefile" , but in excel 365, it would close the file, and also unload all the user forms and trigger the "UserForm_Terminate()". all the user forms are not stored in this "savefile". Unloading user forms would erase and zero all the data in the textboxes of user forms of which I want to keep the values unchanged.
I tried to run in excel 2010 several times today, and pretty sure this "close" command only close the workbook (savefile) and did not trigger unloading or termination of the user forms.
Can anyone shed some light into this area? many thanks for your help.
the following is the code:
Private Sub CommandButton1_Click()
Application.DisplayAlerts = False
SaveFile.Close
Application.DisplayAlerts = True
End Sub
Bookmarks