Share via

FileFormatNum question?

Anonymous
2016-09-09T19:53:35+00:00

I'm a VBS novice...

I am have a script that opens a CSV file in Excel. The next step is to save the file as a Xlsm.

Here is my code but the file format number field shows in Red indicating something is wrong. I have tried FileFormatNum and with out the Num.

This is Excel 2013

Set objExcel = CreateObject("Excel.Application")

Set objWorkbook = objExcel.Workbooks.Open("C:\1datadump\datadump.csv")

objExcel.Application.Visible = True

objExcel.ActiveWorkbook.Save "C:\1datadump\datadump.xls", FileFormatNum:= 51

objExcel.ActiveWorkbook.Close

The VBS syntax is killing me. Every page I read is slightly different.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2016-09-09T20:22:40+00:00

    Thank you for your help Rick.

    I changed to :

    objExcel.ActiveWorkbook.SaveAs "C:\1datadump\datadump.xlsm", FileFormat:= 51

    and I get:

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-09-09T20:02:48+00:00

    The Save method does not provide for a FileFormatNum argument... it is the SaveAs method that does that although the argument name is FileFormat (no Num at the end of it).

    Was this answer helpful?

    0 comments No comments