+ Reply to Thread
Results 1 to 2 of 2

Excel & C# NullReference Error when trying to set Range.Value2

Hybrid View

  1. #1
    Chuck
    Guest

    Excel & C# NullReference Error when trying to set Range.Value2

    When trying to assign a string to the Value2 property of a Range:

    WorksheetA.get_Range("A1",Type.Missing).Value2=curValue.Trim();

    I'm getting this error message:
    Object reference not set to an instance of an object.

    Any suggestions?

  2. #2
    Chuck
    Guest

    RE: Excel & C# NullReference Error when trying to set Range.Value2

    Also, the Range is not null, it is the Value2 object that is null. The
    mystery is how to ensure that the Value2 object is not null.

    "Chuck" wrote:

    > When trying to assign a string to the Value2 property of a Range:
    >
    > WorksheetA.get_Range("A1",Type.Missing).Value2=curValue.Trim();
    >
    > I'm getting this error message:
    > Object reference not set to an instance of an object.
    >
    > Any suggestions?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1