progressive7
Technical User
I am using the below code to convert a csv file to an xls format. it works fine but it will not let me specfiy a file format in the saveas method it justs errors. am i doing anything wrong with the saveas method, btw i am using visual studio
sub convert()
Dim excel As Application
Dim oExcel As Excel.Application
oExcel = New Excel.Application
Dim oBook As Excel.Workbook
Dim input, output As String
On Error GoTo handler
input = "c:\upload\in.csv"
output = "c:\upload\twest.xls"
oBook = oExcel.Workbooks.Open(input)
oBook.SaveAs output, xlExcel9795
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
handler:
MsgBox(Err.Description)
End Sub
sub convert()
Dim excel As Application
Dim oExcel As Excel.Application
oExcel = New Excel.Application
Dim oBook As Excel.Workbook
Dim input, output As String
On Error GoTo handler
input = "c:\upload\in.csv"
output = "c:\upload\twest.xls"
oBook = oExcel.Workbooks.Open(input)
oBook.SaveAs output, xlExcel9795
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
handler:
MsgBox(Err.Description)
End Sub