8

In regards to Excel VBA Interop, what is the correct XlFileFormat enumeration for saving an Excel 97-2003 spreadsheet?

The official MSDN documentation is here but I can't figure out from reading this what the correct selection is.

Thanks

JMK
  • 27,273
  • 52
  • 163
  • 280
  • 1
    I believe best practice is to use the number, for forward-compatibility. In your case I don't think this is much of an issue, but the code for xlExcel8 is 56. – Doug Glancy Aug 28 '12 at 14:03

1 Answers1

17

Excel 97 was version 8. Subsequent releases up to and including Excel 2003 had very minor changes. Until Excel 2007, version 12. Which is why you see xlExcel9 through 11 missing from the enumeration.

So you'll want xlExcel8 here.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • 2
    Thankyou Hans, this worked. As a sidenote, it did prompt me for the Compatibility check alert, as I am using the Excel 14 library. I was able to suppress this by setting the `DoNotPromptForConvert` property of the workbook to true – JMK Aug 28 '12 at 14:41