Connecting Tech Pros Worldwide Forums | Help | Site Map

Export dataset to excel

Member
 
Join Date: Jul 2008
Posts: 77
#1: Sep 4 '08
Hi all,
I want to export dataset to Excel and I get an error when I run this code:
Expand|Select|Wrap|Line Numbers
  1.   For h = 2 To ds.Tables(0).Rows.Count
  2.                 For j = 0 To ds.Tables(0).Columns.Count - 1
  3.                     k = 0
  4.   Excel.Cells(h, j) = IIf(ds.Tables(0).Rows(k).Item(j).ToString = "", "-", ds.Tables(0).Rows(k).Item(j).ToString)
  5.                     k = k + 1
  6.  
  7.                 Next
  8.             Next
The error is:
Exception from HRESULT: 0x800A03EC
What is wrong with this code:

insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#2: Sep 4 '08

re: Export dataset to excel


Maybe this KB article will help.
http://support.microsoft.com/kb/282830/
Reply