Saving Excel 2007 as Excel 97-2003 format

kmmm2008

New member
Joined
Mar 2, 2008
Messages
3
Programming Experience
5-10
I am generating excel spreadsheet in my VB.net application using Office 2007 but I would like to saving it as Excel 97-2003. I do not know how to save using these formats. Any Clue? This is my code.

worksheet.SaveAs(FileName:=path)
workbooks.Close().

I have tried this below but I get an error that format is not recognized.
'With workbooks
' If Val(Application.Version) < 12 Then
' 'You use Excel 97-2003
' FileExtStr = ".xls" : FileFormatNum = -4143
' Else
' 'You use Excel 2007

' Select Case Sourcewb.FileFormat
' Case 51 : FileExtStr = ".xlsx" : FileFormatNum = 51
' Case 52
' If .HasVBProject Then
' FileExtStr = ".xlsm" : FileFormatNum = 52
' Else
' FileExtStr = ".xlsx" : FileFormatNum = 51
' End If
' Case 56 : FileExtStr = ".xls" : FileFormatNum = 56
' Case Else : FileExtStr = ".xlsb" : FileFormatNum = 50
' End Select

' End If
'End With

:confused:


Please help!!
 
Specify one of the XlFileFormat values for the SaveAs method. XlFileFormat.xlExcel8 should be it.
 
Back
Top