SaveAs method of workbook class failed

When I am trying to save a workbook as a .csv file I get the Saveas method failed.

My code is:  xlsFile.Application.ActiveWorkBook.SaveAs Filename:="c:\test.csv", FileFormat:=xlCSV.

If I don't use the FileFormat parameter, the saveas works, but I need the file in a CSV format
gdentenAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
EDDYKTConnect With a Mentor Commented:
xlsFile.Application.ActiveWorkBook.SaveAs Filename:="c:\test.csv", FileFormat:=6
0
 
gdentenAuthor Commented:
I changed the code and it worked.  I guess a follow-up question mostly for my understanding is why didn't xlCSV work.  I copied that code from the MACRO I generated in EXCEL.
0
 
EDDYKTCommented:
If you run from VB, then you may not see it if you don't have Excel reference

Press F2 from ide and to see whether you see it
0
All Courses

From novice to tech pro — start learning today.