Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Below is my code snippet:
Dim ef2 As New Microsoft.Office.Interop.Excel.Application
Dim ws As New Microsoft.Office.Interop.Excel.Worksheet
 
'Imports all the tables from DataSet to new file.
For Each table In [dsExportToSAPData].Tables
    'Add new worksheet to the file.
    ws = ef2.Worksheets.Add(table.TableName)
 
    'Change the value of the first cell in the DataTable.;
    table.Rows(0)(0) = "This is new file!"
 
    'Insert the data from DataTable to the worksheet starting at cell "A1".
    ws.InsertDataTable(table, "A1", True)
Next
Problem here is am getting the Exception "Exception from HRESULT:0x800A03EC" when the below line executed...ws = ef2.Worksheets.Add(table.TableName)... Can anyone help how to solve this exception ?
Posted 27-Oct-11 23:51pm
Edited 28-Oct-11 9:23am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Does excel starts from index 0?
For example, here:
http://www.techonthenet.com/excel/formulas/row.php[^] it seems that indexing starts from 1.
Try changing
table.Rows(0)(0) = "This is new file!"
 
to
table.Rows(1)(1) = "This is new file!"
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

tari maa no bhosdo......bhenchhod.....chhodu jeva page na banavishh
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 403
1 Sergey Alexandrovich Kryukov 227
2 Richard Deeming 180
3 ChauhanAjay 170
4 Snehasish_Nandy 161
0 Sergey Alexandrovich Kryukov 6,367
1 OriginalGriff 5,588
2 CPallini 2,473
3 Richard MacCutchan 1,627
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web03 | 2.8.140821.2 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100