E
Ed
I need (via Word) to open an Excel spreadsheet to read a .csv file that has
'Enters' within the scope of the data (as opposed to at the end of the line
which indicates 'end of record'), and in two very unusual situations, I need
to save the Excel file (.csv) to a 'normal' Excel '.xls' file.
Here is code so far:
Set oXL = CreateObject("Excel.Application")
'('file2convert' is a variable pointing to .csv file)
Set oWB = oXL.Workbooks.Open(file2convert)
'next line simply changes extension of file I want to save from .csv to .xls
file2save = Left(file2convert, InStr(file2convert, ".csv") - 1) & ".xls"
'next line tracks the actual Excel macro code, but the
"FileFormat:=xlNormal" generates error
'if I comment out that part of the line, it saves,
'but only as a csv file with an '.xls' extension.
'iI.e., there was no 'saveas' with a real conversion to xls
oWB.SaveAs FileName:=file2save , fileformat:=xlnormal
Any thoughts to make this work?
Ed (in Virginia)
'Enters' within the scope of the data (as opposed to at the end of the line
which indicates 'end of record'), and in two very unusual situations, I need
to save the Excel file (.csv) to a 'normal' Excel '.xls' file.
Here is code so far:
Set oXL = CreateObject("Excel.Application")
'('file2convert' is a variable pointing to .csv file)
Set oWB = oXL.Workbooks.Open(file2convert)
'next line simply changes extension of file I want to save from .csv to .xls
file2save = Left(file2convert, InStr(file2convert, ".csv") - 1) & ".xls"
'next line tracks the actual Excel macro code, but the
"FileFormat:=xlNormal" generates error
'if I comment out that part of the line, it saves,
'but only as a csv file with an '.xls' extension.
'iI.e., there was no 'saveas' with a real conversion to xls
oWB.SaveAs FileName:=file2save , fileformat:=xlnormal
Any thoughts to make this work?
Ed (in Virginia)