简体   繁体   English

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

[英]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. 当我关闭excel文件时,我要求用户进行调查是否安装了Microsoft Outlook。 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. 这是我来自BeforeClose Worksheet声明的全部代码。 I have also used ActiveWorkbook.Saved = True, ThisWorkbook.Saved = True; 我还使用过ActiveWorkbook.Saved = True,ThisWorkbook.Saved = True; however, the prompt still comes up... 但是,提示仍然出现...

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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