[英]How to fix VBA Error “Cannot saving ”.xlsm“ to ”.xlsx“”?
I'm dividing a workbook in several stores. 我正在将工作簿分配到几个商店。
I choose the store I want to see, and the code filters the data of the other stores and deletes that data, only leaving the data of the choosen store. 我选择了要查看的商店,代码过滤了其他商店的数据并删除了该数据,只保留了所选商店的数据。
and after this I want to make a new workbook, saving as my ".xlsm" file to ".xlsx" 然后,我要制作一个新的工作簿,将“ .xlsm”文件另存为“ .xlsx”
But after runing the code i have a pop up message asking if i want "to continue saving as a macro-free workbook" 但是运行代码后,我弹出消息询问我是否要“继续保存为无宏工作簿”
If i click yes, i have a error saying: 如果单击“是”,则会出现错误提示:
1004 VB Projects and XLM sheets cannot be saved in a macro-free workbook
1004 VB项目和XLM工作表不能保存在无宏工作簿中
What can i do to fix it? 我该如何解决?
this is the code to save the new workbook: 这是保存新工作簿的代码:
Dim Fname As String
Fname = "02.VIM_REPORT MENSAL - " & Worksheets("aux").Range("V2") & " - " & Worksheets("aux").Range("V3") & ".xlsx"
ActiveWorkbook.SaveAs Filename:=Fname, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close False
将该代码行更改为: ActiveWorkbook.SaveAs Filename:=Fname, FileFormat:=xlWorkbookDefault
just disable Alerts. 只需禁用警报。
try with 尝试
Application.DisplayAlerts = False
Dim Fname As String
Fname = "02.VIM_REPORT MENSAL - " & Worksheets("aux").Range("V2") & " - " & Worksheets("aux").Range("V3") & ".xlsx"
ActiveWorkbook.SaveAs Filename:=Fname, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close False
Application.DisplayAlerts = True
good luck 祝好运
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.