C
Chuck
From within a Word macro I'm trying to save an Excel object as a csv file,
but can't seem to find any documentation that explains how to do it. Any
ideas? Code below -- I've tried objExcel.dialogs(xlDialogSaveAs).show but
get an error saying that xlDialogSaveAs is an undefined variable, and when I
try to specify xlCSV as a file format I get the same undefined variable error:
sub SaveAsCSV()
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
[snip - doing stuff to workbook]
objExcel.ActiveWorkbook.SaveAs FileName:="c:\myfile.csv"
'The above line saves as an .xls even if the suffix is ".csv"
objExcel.Application.Quit
Set objExcel = Nothing
end sub
but can't seem to find any documentation that explains how to do it. Any
ideas? Code below -- I've tried objExcel.dialogs(xlDialogSaveAs).show but
get an error saying that xlDialogSaveAs is an undefined variable, and when I
try to specify xlCSV as a file format I get the same undefined variable error:
sub SaveAsCSV()
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
[snip - doing stuff to workbook]
objExcel.ActiveWorkbook.SaveAs FileName:="c:\myfile.csv"
'The above line saves as an .xls even if the suffix is ".csv"
objExcel.Application.Quit
Set objExcel = Nothing
end sub