ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "新文件名", FileFormat:=xlCSV 三、附 XlFileFormat 枚举 (Excel) 指定保存工作表时的文件格式。 名称 值 说明 扩展名 xlWorkbookDefault 51 默认工作簿 *.xlsx xlExcel8 56 Excel 97-200
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & "新文件名" 5) 另存为CSV格式 ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "新文件名", FileFormat:=xlCSV 三、附 XlFileFormat 枚举 (Excel) 指定保存工作表时的文件格式。 名称 值 说明 扩展名...
SaveAs Filename:=ThisWorkbook.Path & "" & Format(Now, "mm-dd-yy") & ".xlsx", FileFormat:=51 .Close SaveChanges:=False End With Application.ScreenUpdating = True End Sub 注:代码整理自vbaexpress.com,供有兴趣的朋友参考。 欢迎在下面留言,完善本文内容,让更多的人学到更完美的知识。 本文参与...
arr=Split(ThisWorkbook.FullName,".")strExtension=arr(UBound(arr))Select Case strExtension Case"xlsb":lngFileFormatCode=50Case"xlsx":lngFileFormatCode=51Case"xlsm":lngFileFormatCode=52Case"xls":lngFileFormatCode=56End Select For Each wks In Worksheets strFileName=strPath&wks.Name&"."&strExte...
wb.SaveAs方法的FileFormat参数设置为52,表示将文件保存为支持宏的.xlsm格式。需要确保指定的保存路径...
xlOpenXMLWorkbook = 51 '打开 XML 工作簿。XlFileFormat 枚举,指定保存工作表时的文件格式。文件
If the parent workbook is not an .xlsx, .xlsm or .xls file, then it will be saved as an .xlsb file. If you always want to save in a certain format you can replace this part of the macro: SelectCaseSourcewb.FileFormatCase51: FileExtStr =".xlsx": FileFormatNum = 51Case52:If....
ActiveWorkbook.SaveAs Filename:="新-" & ActiveWorkbook.Name, FileFormat:=ActiveWorkbook.FileFormat End If '如果活动工作簿是以只读打开,则文件另存为 新-原有文件名,文件格式与当前工作簿的格式相同。 注意:在Excel2010版本中,如果以saveas方法保存时,记得...
The SaveAs function in vba is not working for FileFormat:= 51 The specified dimension is not valid for the current chart type to create Excel file and to store content from data table Transfer Message Box data to a cell in Excell us...
xlDialog(1, 2) = "xlDialogActivate"xlDialog(2, 2) = "xlDialogActiveCellFont"xlDialog(3, 2) = "xlDialogAddChartAutoformat"xlDialog(4, 2) = "xlDialogAddinManager"xlDialog(5, 2) = "xlDialogAlignment"xlDialog(6, 2) = "xlDialogApplyNames"xlDi...