Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
my macro script:
Set objExcelApp = CreateObject("Excel.Application")
Set objExcelDoc = objExcelApp.Workbooks.Add
...
... ...
objExcelDoc.SaveAs vFilePath & "\" & vName
objExcelDoc.Close
The default file type I export is ".xlsx", not ".xls", even if I do as following,
Excel Options-Save-"Save files in this format" and select
"Excel 97-2003 workbook".
Why? How do I export files for Excel 2003?
This code is tested:
sXLS = "test.xls"
Set objExcelApp = CreateObject("Excel.Application")
Set objExcelDoc = objExcelApp.Workbooks.Add
set xlSheet = objExcelDoc.Sheets("Sheet1")
xlSheet.Range("A1").value = "hi there"
objExcelDoc.SaveAs sXLS, 56
objExcelDoc.Close
set obj = ActiveDocument.GetSheetObject("CH01")
obj.ExportBiff "C:\test.xls"
use extension according to your version
Dear sarathi87k,
I will export some tables and charts into 1 sheet in an excel file, so I can not use the function like
ExportBiff .
objExcelDoc.SaveAs vFilePath & "\" & vName
what is Vfilepath & Vname..
I googled this:
.ActiveWorkbook.SaveAs(sXLS), 56 'office 2007
.ActiveWorkbook.SaveAs(sXLS), 43 'office 2003
Dear sarathi87k,
It is file full path, like c:\abc.qvw
Dear mwoolf,
It runs wrong with your code.Set objExcelApp = CreateObject("Excel.Application")
Set objExcelDoc = objExcelApp.Workbooks.Add
objExcelDoc.SaveAs(sXLS), 43 vFilePath & "\" & vName
objExcelDoc.Close
This code is tested:
sXLS = "test.xls"
Set objExcelApp = CreateObject("Excel.Application")
Set objExcelDoc = objExcelApp.Workbooks.Add
set xlSheet = objExcelDoc.Sheets("Sheet1")
xlSheet.Range("A1").value = "hi there"
objExcelDoc.SaveAs sXLS, 56
objExcelDoc.Close