LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.dotnet.framework.interop,microsoft.public.dotnet.languages.csharp,microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Excel.Range.Name gives error an exception

Hi All,

I am trying to execute below code but it gives me an COMException

///// Code Start ////
public string GetName(Excel.Range range)
{
try
{
if (range.Name != null)
{
Excel.Name name = range.Name as Name;

if (name.Name != null || name.Name.Length != 0)
{
return name.Name;
}
return string.Empty;
}
return string.Empty;
}
catch(Exception e)
{
return string.Empty;
}
}

///// Code End ////

Now every time my very third line "if (range.Name != null)" gives me
Exception

an exception of type: {System.Runtime.InteropServices.COMException}
occurred

Any suggestions,


thanks & regards,
Rushi

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Excel Error - Win32 exception Jahrzee Setting up and Configuration of Excel 0 May 28th 07 03:38 AM
Excel.Range.Name gives error an exception [email protected] Excel Discussion (Misc queries) 2 August 23rd 05 08:14 AM
Excel causing exception error upon opening the document dougmcc1[_8_] Excel Programming 1 October 8th 04 12:21 AM
Excel causing exception error upon opening the document dougmcc1[_4_] Excel Programming 1 September 28th 04 11:12 PM
Excel causing exception error upon opening the document dougmcc1[_6_] Excel Programming 0 September 28th 04 04:16 PM


All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"