By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

VB.NET error

P: n/a
Hi,

I have a VB 6.0 code that has been migrated to VB.NET.

This code basically writes data to an Excel file.

On execution of the migrated VB.NET code, I get an error:

-------------------------------------------------------------------------------------------

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll



Additional information: Exception from HRESULT: 0x800A03EC.

--------------------------------------------------------------------------------------------

Please help !

- Gary

Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Gary,

No Help appears to be available from MSDN for that error code. Can you indicate during execution of what line did that error occur?

Regards

Narayan
"Gary" <ms****@microsoft.com> wrote in message news:eB**************@TK2MSFTNGP11.phx.gbl...
Hi,

I have a VB 6.0 code that has been migrated to VB.NET.

This code basically writes data to an Excel file.

On execution of the migrated VB.NET code, I get an error:

-------------------------------------------------------------------------------------------

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll



Additional information: Exception from HRESULT: 0x800A03EC.

--------------------------------------------------------------------------------------------

Please help !

- Gary

Nov 20 '05 #2

P: n/a
Hello,

"Gary" <ms****@microsoft.com> schrieb:
I have a VB 6.0 code that has been migrated to VB.NET.
This code basically writes data to an Excel file.
On execution of the migrated VB.NET code, I get an error:

An unhandled exception of type 'System.Runtime.InteropServices.
COMException' occurred in mscorlib.dll


Help impossible without code.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3

P: n/a
Thanks for replying.
This is the line of code that causes the error:
ExcelGlobal_definst.Selection.Subtotal(GroupBy:=3,
Function:=Excel.XlConsolidationFunction.xlSum, TotalList:=New Object() {8,
9, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28},
Replace_Renamed:=True, PageBreaks:=False, SummaryBelowData:=False)

Thanks again,
Gary

"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:OE*************@tk2msftngp13.phx.gbl...
Hello,

"Gary" <ms****@microsoft.com> schrieb:
I have a VB 6.0 code that has been migrated to VB.NET.
This code basically writes data to an Excel file.
On execution of the migrated VB.NET code, I get an error:

An unhandled exception of type 'System.Runtime.InteropServices.
COMException' occurred in mscorlib.dll


Help impossible without code.

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

Nov 20 '05 #4

P: n/a
"Gary" <ms****@microsoft.com> schrieb
I have a VB 6.0 code that has been migrated to VB.NET.

This code basically writes data to an Excel file.

On execution of the migrated VB.NET code, I get an error:

-------------------------------------------------------------------------- -----------------
An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in
mscorlib.dll

Additional information: Exception from HRESULT: 0x800A03EC.

--------------------------------------------------------------------------

------------------

How should we know an answer without knowing where the error occurs? I may
not have an answer but it would also help others to help you.
--
Armin

Nov 20 '05 #5

P: n/a
Hi Gary,

Firstly there appears to be no named parameter in the method called
Replace_Renamed. Try changing this to Replace: = True.

Another thing:
This appears to be macro recorded code pasted into the project. As you are
probably already aware, MS recommeds this (macro recording) only as a
learning tool. Code generated by recording a Macro is often inefficient
code. An immediate problem that I see with macro recorded code is that it
almost always produces late bound code.

Another thing is that it always uses the Global Selection Property (of the
Application Object). We generally expect it to be a Worksheet Range, but
this could well be an Embedded Chart Object, in which case methods of the
Range object that we use are bound to fail at runtime(but will compile!!).
But if you use something like Worksheet.Cells(x,y), it is less likely to
fail.

It would probably be better to write something like this:

Dim R As Excel.Range
Set R = Ws.Cells(2, 2)

R.Subtotal(3, XlConsolidationFunction.xlSum, New Int32() {3, 4, 5}, True,
False, XlSummaryRow.xlSummaryBelow)

Hope this helps

Narayan

"Gary" <ms****@microsoft.com> wrote in message
news:eV**************@TK2MSFTNGP12.phx.gbl...
Thanks for replying.
This is the line of code that causes the error:
ExcelGlobal_definst.Selection.Subtotal(GroupBy:=3,
Function:=Excel.XlConsolidationFunction.xlSum, TotalList:=New Object() {8,
9, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28},
Replace_Renamed:=True, PageBreaks:=False, SummaryBelowData:=False)

Thanks again,
Gary

"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:OE*************@tk2msftngp13.phx.gbl...
Hello,

"Gary" <ms****@microsoft.com> schrieb:
I have a VB 6.0 code that has been migrated to VB.NET.
This code basically writes data to an Excel file.
On execution of the migrated VB.NET code, I get an error:

An unhandled exception of type 'System.Runtime.InteropServices.
COMException' occurred in mscorlib.dll


Help impossible without code.

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


Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.