为什么我仍然收到保存提示?

时间:2022-04-16 22:50:40

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...

当我关闭我的Excel文件时,如果他们安装了Microsoft Outlook,我会要求用户进行调查。该程序运行良好,我收到调查结果的电子邮件。但是,仍然会提示“您要保存此文档吗?”我已经使用了我之前的代码来阻止此提示出现,它是......

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...

这是我在BeforeClose工作表声明中的完整代码。我还使用了ActiveWorkbook.Saved = True,ThisWorkbook.Saved = True;然而,提示仍然出现......

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

UserForm2.Show转到我的用户表单,提示调查。

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

1 个解决方案

#1


0  

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 ?

您是否尝试在Me.Saved = True后添加Application.DisplayAlerts = False?

#1


0  

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 ?

您是否尝试在Me.Saved = True后添加Application.DisplayAlerts = False?