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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,215,506
Messages
6,125,193
Members
449,213
Latest member
Kirbito

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