调用工作簿对象的 Close 方法: 使用工作簿对象的 Close 方法来关闭文件,并将 SaveChanges 参数设置为 False,以确保不保存更改。 以下是具体的代码示例: 关闭当前活动的工作簿而不保存更改: vba Sub CloseWorkbookWithoutSaving() ' 关闭当前活动的工作簿而不保存更改 ThisWorkbook.Close SaveChanges:=False End Sub...
Sub CloseWorkbooks() Dim wb As Workbook wb.Close End Sub ``` 💡 小贴士:这个简单的宏将关闭你所有打开的工作簿,方便快捷!4️⃣ 退出整个Excel应用程序: ```vba Sub CloseExcelApp() Application.Quit End Sub ``` 💡 小贴士:想要结束整个Excel会话?用这个宏,一键搞定!0 4 发表评论 发表 作者...
8 关闭工作簿而不保存Close a Workbook without Saving Sub mynzvba_close_Activeworkbook() ActiveWorkbook.Close SaveChanges:=False End Sub 本节内容参考程序文件:Chapter03-2.xlsm 9 保存并关闭工作簿Close a Workbook after Saving Sub mynzvba_close_workbook() Dim wbCheck As String wbCheck = Dir(ThisWor...
这样程序需要根据工作簿保存的时间找到这个最新保存的工作簿,然后再对其进行处理。
问运行VBA宏时Excel意外关闭(但仅偶尔)EN在Word中,按Alt+F11组合键打开VBE,然后在“工程 – Project...
' Close the workbook without saving changes wb.Close SaveChanges:=False End If ' Get the next ...
Save the Excel (.xlsm) workbook as an Excel Add-in (.xlam). Close this Excel workbook without saving the changes. Test out your newly saved add-in (open it, access the vbe, try to expand the project window, you should get the new message "Project is Unviewable" ...
Lesson 14 on Excel macros (VBA): VBA Code for Workbooks To develop a VBA procedure that is triggered by an event relating to the workbook (when you open it, when you save it, when you close it) see theVBA lesson on events.
Step 7:Close the workbook without saving anything Here is a sample of what you will find in lchapter14 of the downloadableTutorial on Excel macros VBA Code for Workbooks To develop a VBA procedure that is triggered by an event relating to the workbook (when you open it, when you save it...
wbImport.Close SaveChanges:=False 'close wb without saving App.Quit 'quit the hidden Excel ...