Save as in Vb.net as excel object

benl

New Member
Joined
Apr 2, 2004
Messages
10
Hi,
Is anyone try to save excel object in vb.net? I have problem below:

I run the code below in vb.net and it have "error: 1004. Exception from HRESULT: 0x800A03EC"

xlsApp = New Excel.Application
xlsBook = xlsApp.Workbooks.Open(Filename:="D:\test.xls", UpdateLinks:=False, ReadOnly:=False)
xlsSheet = xlsBook.ActiveSheet()
xlsSheet.SaveAs(FileName:="D:\commaTEST", FileFormat:="xlCSV")


Thanks for your help...

Ben
 
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
Dim misValue As Object = System.Reflection.Missing.Value

xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Add(misValue)
xlWorkSheet = xlWorkBook.Sheets("sheet1")
xlWorkSheet.Cells(1, 1) = "test"
xlWorkSheet.SaveAs("C:\vbexcel.xlsx")

full sourec ... How to create an Excel 2007 file in VB.NET


steve
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,216,105
Messages
6,128,861
Members
449,472
Latest member
ebc9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top