vba'编译器错误预期:='在saveAs操作

时间:2022-11-30 09:44:13

The following line in my VBA code is generating the compile error 'Compiler error expected: =' implying that it expected an assignment. What am I doing wrong and how do I fix this?

我的VBA代码中的以下行生成编译错误'Compiler error expected:='暗示它期望分配。我做错了什么,如何解决这个问题?

I just want to save the file. Also, I want to overwrite the file which was previously a .xls or .xlsx file. Will this line do that?

我只是想保存文件。此外,我想覆盖以前是.xls或.xlsx文件的文件。这条线会这样吗?

Workbooks(theFile).SaveAs("Z:\test\vhb\" & newName, xlCSV)

1 个解决方案

#1


15  

You do not use parentheses unless you are assigning to a variable.

除非分配给变量,否则不要使用括号。

Workbooks(theFile).SaveAs "Z:\test\vhb\" & newName, xlCSV

#1


15  

You do not use parentheses unless you are assigning to a variable.

除非分配给变量,否则不要使用括号。

Workbooks(theFile).SaveAs "Z:\test\vhb\" & newName, xlCSV