SaveAs(FileName,FileFormat,Password,WriteResPassword,ReadOnlyRecommended,CreateBackup,AccessMode,ConflictResolution,AddToMru,TextCodepage,TextVisualLayout,Local)参数Filename可选,表示要保存文件的文件名的字符串。可包含完整路径,如果不指定路径,将文件保存到当前文件夹中。使用SaveAs方法将工作簿另存为新文件后...
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "新文件名", FileFormat:=xlOpenXMLWorkbookMacroEnabled 2)另存为早期的xls的工作簿(Excel 2002 2003等) ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "新文件名", FileFormat:=xlExcel8 3)另存为另一个名称的xlsx(默认格式)的...
1 新建一个Excel文件并保存。打开VBE,可以用快捷键<Alt+F11>.VBE的介绍可以参照下面的链接后者百度下找找。2 新建一个模块,输入下面的代码。Sub SaveAsMacroEnable() Dim OldFileName As String OldFileName = Left(ThisWorkbook.FullName, InStr(ThisWorkbook.FullName, ".") - 1) ActiveWorkbook.SaveAs...
To save an Excel workbook using VBA, you need to use the SAVE method to write a macro. And in that macro, you need to specify the workbook that you want to save and then use the SAVE method. When you run this code, it works like the keyboard shortcut (Control + S). Specify the...
代码中并没有使用 save 方法,应该不会出现这个错误。我检验了一下代码,没有错误。只是代码设计得不够精练,重复代码太多。另外存在一个小小问题,举例来说:arr = Sheet4.Range("A7:A" & Sheet4.[A100000].End(3).Row),如果A6以下没有数据,程序设置的数据有效性系列就背离了你的设计意图,...
You can also free up your time for more value-added activities such as strategic planning, decision making, and problem solving. Or so you could have a bit of fun! In this article, we’ll show you how Excel VBA can automate accounting tasks and save you time and money. We’ll give ...
How To Save An Excel File As PDF Using VBA: Basic Code Examples (Examples #1 And #2) Now that you are familiar with the ExportAsFixedFormat VBA method, let's take a look at some code examples. For purposes of this example, I have prepared a sample Excel workbook. This workbook contains...
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 ale...
And now save file as new Workbook: ActiveWorkbook.SaveAs Filename:= NewFile, _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False We have to close new file and open the origin workbook: ...
E盘 或 E:\收据\ 这个目录不存在 问题补充:“工具”菜单下“选项”对话框“安全性”选项卡中的“保存时从文件属性中删除个人信息”不要选中就没提示了 1