简体   繁体   中英

Why am I still getting a save prompt?

When I close my excel file, I ask the user to take a survey if they have Microsoft Outlook installed. The program works great and I receive the email with the survey results. However, they are still prompted with the "Do you want to save this document?" I have used my previous code to stop this prompt from coming up and it is...

Me.Saved = True

This has worked prior to this. However, the saving prompt still comes up. I am wondering why this is happening.

Here is my entire code from the BeforeClose Worksheet declaration. I have also used ActiveWorkbook.Saved = True, ThisWorkbook.Saved = True; however, the prompt still comes up...

UserForm2.Show goes to my userform that prompts the survey.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
UserForm2.Show
Me.Saved = True
End Sub

I can't recreate this issue on my system, as your code seems to be working.

Have you tried adding Application.DisplayAlerts = False after Me.Saved = True ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM