[英]Excel 2007 VBA ActiveWorkbook SaveAs not saving … Run-time error 1004
I had Excel record the steps of choosing Save As and applying a specific location and file name, and it produces this VBA code: 我让Excel记录了选择“另存为”并应用特定位置和文件名的步骤,并产生了以下VBA代码:
ActiveWorkbook.SaveAs Filename:= _
"H:\Documents\Data\Tasks\Transfer.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Have also tried setting the FileFormat as 还尝试将FileFormat设置为
FileFormat:=51
I also included the following handlers, but it doesn't work with or without them: 我还包括以下处理程序,但无论有没有这些处理程序都无法使用:
On Error Resume Next
Application.DisplayAlerts = False
The original file is in .xls format. 原始文件为.xls格式。
When I run the macro allowing display alerts, it produces this error: 当我运行允许显示警报的宏时,它将产生以下错误:
Run-time error '1004':
Method 'SaveAs' of object '_Workbook' failed
This used to work until I believe going to Windows 8 and a new network server at work. 在我相信要使用Windows 8和新的网络服务器之前,这种方法一直有效。 Could something like that affect SaveAs? 这样会影响SaveAs吗?
What am I missing? 我想念什么? Thanks for any tips you might have. 感谢您提供的任何提示。
尝试这个
Application.ActiveWorkbook.SaveAs Filename:="H:\Documents\Data\Tasks\Transfer.xlsx", fileformat:=51
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.