Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vba 'Compiler error expected: =' on saveAs operation

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?

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?

Workbooks(theFile).SaveAs("Z:\test\vhb\" & newName, xlCSV)
like image 811
Brian Avatar asked Dec 07 '22 16:12

Brian


1 Answers

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

Workbooks(theFile).SaveAs "Z:\test\vhb\" & newName, xlCSV
like image 184
Fionnuala Avatar answered Dec 21 '22 07:12

Fionnuala