473,503 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception from HRESULT: 0x800A03EC

Additional information: Exception from HRESULT: 0x800A03EC.

This code produced this error. I am pretty sure I got this to run a while
back and I was wondering if you all see anything I am doing wrong.....or do
you have a suggestion for a better way.......I do know this method is quite
slow.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim WSheet As New Excel.Worksheet
Dim colindex As Integer
Dim Excel As New Excel.Application
Dim rowindex As Integer
Try
OleDbDataAdapter1.Fill(DataSet11.ITEMS)
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try

With WSheet
Dim col As DataColumn
colindex = 1
Dim rowon As Integer = 1
For Each col In DataSet11.Tables(0).Columns
'colindex += 1
Excel.Cells(rowon, colindex) = col.ColumnName.ToString
colindex = colindex + 1
Next col
Dim row As DataRow
colindex = 1
rowindex = 2
For Each row In DataSet11.Tables(0).Rows

For Each col In DataSet11.Tables(0).Columns
'colindex += 1
.Cells(rowindex, colindex).Value =
row(col.ColumnName).ToString()
rowindex = rowindex + 1
colindex = colindex + 1
Next col
Next row
Try
'Saving .xls file with Test.xls name
WSheet.SaveAs("C:\TEST.XLS")
Catch
End Try
'setting up caption that "File Created"
Me.Text = "File Created"
'closing down workbook
EXL.Workbooks.Close()
End With

End Sub
Nov 20 '05 #1
8 14471
I figured it out on the cell by cell approach.

If anyone could show me an example using this code how I could have used an
array to do this I would love to see it.....Thank You...

"scorpion53061" <sc************@yahoo.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
Additional information: Exception from HRESULT: 0x800A03EC.

This code produced this error. I am pretty sure I got this to run a while
back and I was wondering if you all see anything I am doing wrong.....or do you have a suggestion for a better way.......I do know this method is quite slow.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim WSheet As New Excel.Worksheet
Dim colindex As Integer
Dim Excel As New Excel.Application
Dim rowindex As Integer
Try
OleDbDataAdapter1.Fill(DataSet11.ITEMS)
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try

With WSheet
Dim col As DataColumn
colindex = 1
Dim rowon As Integer = 1
For Each col In DataSet11.Tables(0).Columns
'colindex += 1
Excel.Cells(rowon, colindex) = col.ColumnName.ToString
colindex = colindex + 1
Next col
Dim row As DataRow
colindex = 1
rowindex = 2
For Each row In DataSet11.Tables(0).Rows

For Each col In DataSet11.Tables(0).Columns
'colindex += 1
.Cells(rowindex, colindex).Value =
row(col.ColumnName).ToString()
rowindex = rowindex + 1
colindex = colindex + 1
Next col
Next row
Try
'Saving .xls file with Test.xls name
WSheet.SaveAs("C:\TEST.XLS")
Catch
End Try
'setting up caption that "File Created"
Me.Text = "File Created"
'closing down workbook
EXL.Workbooks.Close()
End With

End Sub

Nov 20 '05 #2
Cor
Hi Scorpion,
I have put that what I promished yesterday in that mailstring.
Cor
Nov 20 '05 #3
This was the corrected code......if anyone could show me how to do this with
an Array in this code I would be greatful.....

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim WSheet As New Excel.Worksheet
Dim colindex As Integer
Dim Excel As New Excel.Application
Dim rowindex As Integer

Try
OleDbDataAdapter1.Fill(DataSet11.ITEMS)
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
Excel.Visible = True
WSheet = Excel.Workbooks.Add.Worksheets.Add
With WSheet
Dim col As DataColumn
Dim i, r, c As Integer
For i = 0 To DataSet11.Tables.Count - 1
colindex = 1
Dim rowon As Integer = 1
For c = 0 To DataSet11.Tables(i).Columns.Count - 1
Excel.Cells(rowon, colindex).Value =
DataSet11.Tables(i).Columns(c).ColumnName
colindex = colindex + 1
Next
colindex = 1
rowon = 2
For r = 0 To DataSet11.Tables(i).Rows.Count - 1
For c = 0 To DataSet11.Tables(i).Columns.Count - 1
Excel.Cells(rowon, colindex).Value =
DataSet11.Tables(i).Rows(r).Item(c)
colindex = colindex + 1
Next
rowon = rowon + 1
colindex = 1
Next

Next
Try
'Saving .xls file with Test.xls name
WSheet.SaveAs("C:\TEST.XLS")
Catch
End Try
'setting up caption that "File Created"
Me.Text = "File Created"
'closing down workbook
EXL.Workbooks.Close()
End With

End Sub
"scorpion53061" <sc************@yahoo.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
I figured it out on the cell by cell approach.

If anyone could show me an example using this code how I could have used an array to do this I would love to see it.....Thank You...

"scorpion53061" <sc************@yahoo.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
Additional information: Exception from HRESULT: 0x800A03EC.

This code produced this error. I am pretty sure I got this to run a while back and I was wondering if you all see anything I am doing wrong.....or

do
you have a suggestion for a better way.......I do know this method is

quite
slow.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim WSheet As New Excel.Worksheet
Dim colindex As Integer
Dim Excel As New Excel.Application
Dim rowindex As Integer
Try
OleDbDataAdapter1.Fill(DataSet11.ITEMS)
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try

With WSheet
Dim col As DataColumn
colindex = 1
Dim rowon As Integer = 1
For Each col In DataSet11.Tables(0).Columns
'colindex += 1
Excel.Cells(rowon, colindex) = col.ColumnName.ToString
colindex = colindex + 1
Next col
Dim row As DataRow
colindex = 1
rowindex = 2
For Each row In DataSet11.Tables(0).Rows

For Each col In DataSet11.Tables(0).Columns
'colindex += 1
.Cells(rowindex, colindex).Value =
row(col.ColumnName).ToString()
rowindex = rowindex + 1
colindex = colindex + 1
Next col
Next row
Try
'Saving .xls file with Test.xls name
WSheet.SaveAs("C:\TEST.XLS")
Catch
End Try
'setting up caption that "File Created"
Me.Text = "File Created"
'closing down workbook
EXL.Workbooks.Close()
End With

End Sub


Nov 20 '05 #4
A 32,000 row spreadsheet using this method (14 columns) took almost 45
minutes.

If anyone has ideas on how to improve this situation I would be greatful.

"scorpion53061" <sc************@yahoo.com> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
This was the corrected code......if anyone could show me how to do this with an Array in this code I would be greatful.....

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim WSheet As New Excel.Worksheet
Dim colindex As Integer
Dim Excel As New Excel.Application
Dim rowindex As Integer

Try
OleDbDataAdapter1.Fill(DataSet11.ITEMS)
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
Excel.Visible = True
WSheet = Excel.Workbooks.Add.Worksheets.Add
With WSheet
Dim col As DataColumn
Dim i, r, c As Integer
For i = 0 To DataSet11.Tables.Count - 1
colindex = 1
Dim rowon As Integer = 1
For c = 0 To DataSet11.Tables(i).Columns.Count - 1
Excel.Cells(rowon, colindex).Value =
DataSet11.Tables(i).Columns(c).ColumnName
colindex = colindex + 1
Next
colindex = 1
rowon = 2
For r = 0 To DataSet11.Tables(i).Rows.Count - 1
For c = 0 To DataSet11.Tables(i).Columns.Count - 1
Excel.Cells(rowon, colindex).Value =
DataSet11.Tables(i).Rows(r).Item(c)
colindex = colindex + 1
Next
rowon = rowon + 1
colindex = 1
Next

Next
Try
'Saving .xls file with Test.xls name
WSheet.SaveAs("C:\TEST.XLS")
Catch
End Try
'setting up caption that "File Created"
Me.Text = "File Created"
'closing down workbook
EXL.Workbooks.Close()
End With

End Sub
"scorpion53061" <sc************@yahoo.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
I figured it out on the cell by cell approach.

If anyone could show me an example using this code how I could have used

an
array to do this I would love to see it.....Thank You...

"scorpion53061" <sc************@yahoo.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
Additional information: Exception from HRESULT: 0x800A03EC.

This code produced this error. I am pretty sure I got this to run a while back and I was wondering if you all see anything I am doing
wrong.....or do
you have a suggestion for a better way.......I do know this method is

quite
slow.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim WSheet As New Excel.Worksheet
Dim colindex As Integer
Dim Excel As New Excel.Application
Dim rowindex As Integer
Try
OleDbDataAdapter1.Fill(DataSet11.ITEMS)
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try

With WSheet
Dim col As DataColumn
colindex = 1
Dim rowon As Integer = 1
For Each col In DataSet11.Tables(0).Columns
'colindex += 1
Excel.Cells(rowon, colindex) = col.ColumnName.ToString
colindex = colindex + 1
Next col
Dim row As DataRow
colindex = 1
rowindex = 2
For Each row In DataSet11.Tables(0).Rows

For Each col In DataSet11.Tables(0).Columns
'colindex += 1
.Cells(rowindex, colindex).Value =
row(col.ColumnName).ToString()
rowindex = rowindex + 1
colindex = colindex + 1
Next col
Next row
Try
'Saving .xls file with Test.xls name
WSheet.SaveAs("C:\TEST.XLS")
Catch
End Try
'setting up caption that "File Created"
Me.Text = "File Created"
'closing down workbook
EXL.Workbooks.Close()
End With

End Sub



Nov 20 '05 #5
Problem Solved......
"scorpion53061" <sc************@yahoo.com> wrote in message
news:OM****************@TK2MSFTNGP10.phx.gbl...
A 32,000 row spreadsheet using this method (14 columns) took almost 45
minutes.

If anyone has ideas on how to improve this situation I would be greatful.

"scorpion53061" <sc************@yahoo.com> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
This was the corrected code......if anyone could show me how to do this

with
an Array in this code I would be greatful.....

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim WSheet As New Excel.Worksheet
Dim colindex As Integer
Dim Excel As New Excel.Application
Dim rowindex As Integer

Try
OleDbDataAdapter1.Fill(DataSet11.ITEMS)
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
Excel.Visible = True
WSheet = Excel.Workbooks.Add.Worksheets.Add
With WSheet
Dim col As DataColumn
Dim i, r, c As Integer
For i = 0 To DataSet11.Tables.Count - 1
colindex = 1
Dim rowon As Integer = 1
For c = 0 To DataSet11.Tables(i).Columns.Count - 1
Excel.Cells(rowon, colindex).Value =
DataSet11.Tables(i).Columns(c).ColumnName
colindex = colindex + 1
Next
colindex = 1
rowon = 2
For r = 0 To DataSet11.Tables(i).Rows.Count - 1
For c = 0 To DataSet11.Tables(i).Columns.Count - 1
Excel.Cells(rowon, colindex).Value =
DataSet11.Tables(i).Rows(r).Item(c)
colindex = colindex + 1
Next
rowon = rowon + 1
colindex = 1
Next

Next
Try
'Saving .xls file with Test.xls name
WSheet.SaveAs("C:\TEST.XLS")
Catch
End Try
'setting up caption that "File Created"
Me.Text = "File Created"
'closing down workbook
EXL.Workbooks.Close()
End With

End Sub
"scorpion53061" <sc************@yahoo.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
I figured it out on the cell by cell approach.

If anyone could show me an example using this code how I could have used
an
array to do this I would love to see it.....Thank You...

"scorpion53061" <sc************@yahoo.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
> Additional information: Exception from HRESULT: 0x800A03EC.
>
> This code produced this error. I am pretty sure I got this to run a

while
> back and I was wondering if you all see anything I am doing wrong.....or do
> you have a suggestion for a better way.......I do know this method

is quite
> slow.
>
>
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button2.Click
> Dim WSheet As New Excel.Worksheet
> Dim colindex As Integer
> Dim Excel As New Excel.Application
> Dim rowindex As Integer
> Try
> OleDbDataAdapter1.Fill(DataSet11.ITEMS)
> Catch ex As Exception
> MessageBox.Show(ex.ToString())
> End Try
>
> With WSheet
> Dim col As DataColumn
> colindex = 1
> Dim rowon As Integer = 1
> For Each col In DataSet11.Tables(0).Columns
> 'colindex += 1
> Excel.Cells(rowon, colindex) = col.ColumnName.ToString > colindex = colindex + 1
> Next col
> Dim row As DataRow
> colindex = 1
> rowindex = 2
> For Each row In DataSet11.Tables(0).Rows
>
> For Each col In DataSet11.Tables(0).Columns
> 'colindex += 1
> .Cells(rowindex, colindex).Value =
> row(col.ColumnName).ToString()
> rowindex = rowindex + 1
> colindex = colindex + 1
> Next col
> Next row
> Try
> 'Saving .xls file with Test.xls name
> WSheet.SaveAs("C:\TEST.XLS")
> Catch
> End Try
> 'setting up caption that "File Created"
> Me.Text = "File Created"
> 'closing down workbook
> EXL.Workbooks.Close()
> End With
>
> End Sub
>
>



Nov 20 '05 #6
* "scorpion53061" <sc************@yahoo.com> scripsit:
Problem Solved......


How did you solve it?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
Sorry,

I am more familiar with ArrayLists than plain old arrays (I have only been
exposed to .NET stuff - kind of a newbie at this stuff and in situaitons
like this you work with what you know - at least kind of)

I wrote each column to an ArrayList and then wrote each arraylist to the
spreadsheet with a loop.

Only problem is I am having problems doing formatting of the data but the
boss can live without this.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uL****************@TK2MSFTNGP09.phx.gbl...
* "scorpion53061" <sc************@yahoo.com> scripsit:
Problem Solved......


How did you solve it?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Nov 20 '05 #8
cut the 45 minutes down to under 10 seconds this way......

"scorpion53061" <sc************@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Sorry,

I am more familiar with ArrayLists than plain old arrays (I have only been
exposed to .NET stuff - kind of a newbie at this stuff and in situaitons
like this you work with what you know - at least kind of)

I wrote each column to an ArrayList and then wrote each arraylist to the
spreadsheet with a loop.

Only problem is I am having problems doing formatting of the data but the
boss can live without this.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uL****************@TK2MSFTNGP09.phx.gbl...
* "scorpion53061" <sc************@yahoo.com> scripsit:
Problem Solved......


How did you solve it?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>


Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
11224
by: Steven | last post by:
Hi there, I am trying to export a chart using the Excel11 object from C#. I can properly open workbooks and read cells, but calling Export() on the Chart object throws a COMException ...
3
7830
by: Lekyan | last post by:
I have problem setting the password for an ADAM user using C#. I used the SetPassword code given in the Microsoft page, changed several parameters, but ran into an exception. I wonder if other...
0
4133
by: e-lores | last post by:
I need to print an excel doc to PDF. I'm doing next until now 1.- First I print the file to PostScript format using 'Acrobat Distiller' printer Dim wbook As Excel.Workbook wbook =...
2
36952
by: Sai | last post by:
Hi, I have written a small tool for our internal purpose in VB.net. This tool reads data from logs and saves it in an excel file. This tool is working fine with MS Office 2000 but raising the...
2
17298
by: sgr | last post by:
Hello I'm making an application that uses an excel worksheet, My problem appears when I open the worksheet to see the data (then I close it and save the changes) and I try to insert a new row from...
0
4903
by: rGh | last post by:
Hello, I am trying to create an Excel chart from C#. I am not a very experieced programmer, so my mistake could be very trivial. The code included is a very simple example. I just wanted to...
0
1802
by: hne | last post by:
Hi friends, I have an application, written in C#, in which I am updating an Excel spreadsheet with data I pull from a sql database. When I try to select a cell in where I want to begin inserting my...
0
1205
by: Stephen Plotnick | last post by:
I'm getting HRESULT: 0x800A03EC On this statement: cfDataBar = osheet.Range(RangeText).FormatConditions.AddDatabar with these values in RangeText:...
1
16353
by: fadi980 | last post by:
Hi, I'm exporting a data set into excel file from an ASP.NET application (VS 2008). On my PC, i got everything working just fine. but on my client server i got the error ( Exception from HRESULT:...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5021
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.