Saving File in Excel-Export

Hi Currently we have Upgraded the version of excel 2000 to excel 2003.We were having some database which were exporting the data to excel but now i am getting the Automation error on “Call excelNewWkbk.SaveAs(vtFileName)”

For Reference i am pasting the code.

excelNewWkbk.Save

excelNewWkbk.Close

Set excelApp = CreateObject(“Excel.Application”)

If excelApp Is Nothing Then 

	sMessage = "Could not create spreadsheet." & Chr$( 10 ) & _

	"Make sure Excel is installed on this computer." 

	Msgbox sMessage, 16, "Creation of Spreadsheet Object Failed"

	CreateExcelObject = False

	Exit Sub 

End If 



vtFileName = w.SaveFileDialog(False, "Choose New File", "Microsoft Excel|*.xls", "E\:")



excelApp.DisplayAlerts = False

Set excelNewWkbk = excelApp.Workbooks.Add















If Isempty(vtFileName) Then

	excelApp.Quit

	CreateExcelObject = False

	Exit Sub

End If









Set  excelNewWkbk = excelapp.workbooks(1).Worksheets(1)













Call excelNewWkbk.SaveAs(vtFileName)

Subject: Saving File in Excel-Export

I’m using 2003 and I have the following line of code that works for me:

xlsheet.SaveAs filename

No () around the file name.

Hope this helps.