Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Go Back  Xtreme Visual Basic Talk > > > Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC


Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2012, 06:10 AM
ernie99 ernie99 is offline
Newcomer
 
Join Date: Dec 2011
Posts: 1
Default Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC


I'm trying to get a named range from an Excel Worksheet called Data. I can see that the named range definitely exists in my Worksheet it refers to =Data!$A$1:$D$71.

When I execute the following
Code:
Dim userDataRange As MSExcel.Range = Nothing
userDataRange = dataWorksheet.Range("r.DataArea")
I get the following typically obscure COM exception

System.Runtime.InteropServices.COMException was caught
ErrorCode=-2146827284
Message=Exception from HRESULT: 0x800A03EC
Source=""
StackTrace:
Server stack trace:
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Office.Interop.Excel._Worksheet.get_Range(Object Cell1, Object Cell2)
at ...


Does anybody know where to start debugging this problem or does anyone have a possible workaround?

I am able to perform other operations against the Worksheet so it is not corrupt. I have checked the Interop.Excel.Names collection and the named range I am looking for exists in that collection.

I thought perhaps the following might be a workaround but that fails as well.
Code:
For Each namedRange As MSExcel.Name In dataWorksheet.Names
    If namedRange.Name.Contains("r.DataArea") Then
        Return namedRange.RefersToRange()
    End If
Next
Thanks for your help.
Reply With Quote
  #2  
Old 04-09-2012, 03:41 PM
DennisW's Avatar
DennisW DennisW is offline
Junior Contributor
 
Join Date: Mar 2006
Location: Östersund, Sweden
Posts: 268
Default

Welcome to the board

The name "Data" belongs to the group of words that are reserved. If You temporarily change the name to something else and then executed the second snippet what will the outcome be?
__________________
Kind regards,
Dennis

.NET & Excel | 2nd edition PED | MVP
Reply With Quote
Reply

Tags
excel 2007, range, vb.net


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
 
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
Excel - Worksheet.Range("MyNamedRange") - COM Exception 0x800A03EC
 
-->