'在模块中声明全局变量,通过窗体中控制全局变量的值来执行你需要的功能!Dim 全局变量 As BooleanPrivate Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If 全局变量 = True Then Cancel = False Else Cancel = True End IfEnd Sub