在新打开的模块代码窗口中,输入以下代码: vba Sub CloseWithoutSaving() Dim wb As Workbook For Each wb In Workbooks wb.Close SaveChanges:=False Next wb End Sub 这段代码会遍历所有打开的工作簿,并关闭它们,同时不保存任何更改。运行代码: 关闭VBA编辑器,回到Excel界面。你可以通过【开发工具】 -> 【...
In Microsoft Excel, you can create a Microsoft Visual Basic for Applications (VBA) macro that suppresses theSave Changesprompt when you close a workbook. This can be done either by specifying the state of the workbookSavedproperty, or by suppressing all al...
问运行VBA宏时Excel意外关闭(但仅偶尔)EN在Word中,按Alt+F11组合键打开VBE,然后在“工程 – Project...
VBA:跳转到母版表 Sub GoToSheet() UpdatebyExtendoffice20180427 Sheets("Master").Activate End Sub Copy Note: In the code slice of Sheets("Master").Activate, you can change the Master to any sheet name as you need. 3. Then save this code, and go back to the workbook, click Developer >...
Close a powershell window when called from a batch file Close all popups pulled from running a an executable Close Excel com object without saving changes? Close Form cluster name using powershell cmd batch launch powershell script and getting environment variables set by powershell script cmdlet...
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...
If a workbook has never been saved, itsPathproperty returns an empty string (""). You can set this property toTrueif you want to close a modified workbook without either saving it or being prompted to save it. Example This example displays a message if the active workbook contains unsaved...
If you want to close the workbook within which your VBA procedure (macro) runs without saving it you will write these two lines of code: ThisWorkbook.Saved=True ThisWorkbook.Close Verifying the existence of a file When you want to verify if a certain file exists on your disk you will use...
Try saving your workbook one more after reopening it. You'll need to launch Task Manager and force the Excel.exe program to end if Excel does not close. Method 3. Remove Third-party Add-Ins Occasionally, the add-ins on your Excel disk can cause issues. When you attempt to save your ...
If a workbook has never been saved, itsPathproperty returns an empty string (""). You can set this property toTrueif you want to close a modified workbook without either saving it or being prompted to save it. Example This example displays a message if the active workbook contains unsaved...