Link to home
Start Free TrialLog in
Avatar of ipavlo
ipavlo

asked on

VB.NET - Convert xls to csv

Trying to use VB.NET to convert excel files to csv.

Code below -
Dim xlBook As Excel.Workbook
xlBook = GetObject("C:\excelstore\book1.xls")
 xlBook.SaveAs(Filename:="c:\TEST.csv", FileFormat:="CSV")

When I run this I get a Com Exception error

Using VS 2005 and Excel 2003
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ipavlo
ipavlo

ASKER

Thank you so much Wayne.
For an update I did not have the interop references on a clean install and had to download them from -
http://download.microsoft.com/download/c/4/8/c4813cc0-a4d4-4bb4-b486-9cbd56f38235/oxppia.exe
and browse to them from the project

Thanks again :-)
Pavlo
What Imports did you use for this?

I'm trying to do this in a SSIS Script Task, which allows you to write VB.NET to achieve certain things.

Is it possible to do this on a server that does not have Excel installed?

Thanks,

Pete