另存为启用宏的工作簿 [英] Saving as Macro enabled workbook
本文介绍了另存为启用宏的工作簿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
VBA无法另存为 .xlsm
文件.如果我将标准文件另存为 .xls
文件,则可以将文件保存在正确的位置.
VBA fails to save as .xlsm
files.
If I save as standard .xls
file entire code works, I get my files saved in the right location.
任务:从当前的书中,循环浏览"CategoryList"工作表中的单元格,并创建工作簿的副本,然后另存为原始文件(.xlsm)并返回.
Task: From the current book, Loop through cells in "CategoryList" sheet and create copy of workbook and save as original (.xlsm) and return.
ActiveWorkbook.SaveAs文件名:= FPath&MyCat(i)**->用作.xls
尝试的方法:
ActiveWorkbook.SaveAs Filename:=FPath & MyCat(i) & ".xlsm"
ActiveWorkbook.SaveAs Filename:=FPath & MyCat(i), FileFormat:=".xlsm
这将导致出现一个窗口,要求将工作簿另存为书.
these results in a window asking to save the workbook as book.
我的代码
For i = 1 To 5
MyCategoty(i) = Sheets("CategoryList").Cells(i, 1).Value
wb.Sheets("SheetName").Copy
.....my activity....
ActiveWorkbook.SaveAs Filename:=FPath & MyCat(i), FileFormat:=".xlsm"
ActiveWorkbook.Close
ws.Activate
Next i
有人可以帮忙吗?
Can someone help please.
推荐答案
尝试这样的文件格式:
FileFormat:=xlOpenXMLWorkbook
记住您可能拥有的打开的书,以及其中有代码的书.
Remember the open books you may have and which one has the code.
这篇关于另存为启用宏的工作簿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文