Simple Excel 2007 VBA Enum question

The following causes an error in Excel 2003 but works in 2007:

wbk.SaveAs Filename:=sFile, FileFormat:=xlExcel8, CreateBackup:=False

What file format constant do I need to use to have this work in both 2003 and 2007?
Who is Participating?
Saurabh Singh TeotiaConnect With a Mentor Commented:
Use this...

wbk.SaveAs sFile, xlWorkbookNormal

Open in new window

fhillyer1Connect With a Mentor Commented:
excel 2003 does not understands the xlExcel8 format so you need the following

if application.Version > 11 then
    wbk.SaveAs Filename:=sFile, FileFormat:=xlExcel8, CreateBackup:=False
    wbk.SaveAs Filename:=sFile, FileFormat:=xlWorkbookNormal, CreateBackup:=False
End if

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.