Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:54:00+00:00 2026-06-14T10:54:00+00:00

I am getting a System.com_object error if I am trying to read the EXCEL

  • 0

I am getting a System.com_object error if I am trying to read the EXCEL cell which is empty. My code is :

public static List<OrderPC> getFilters(string fileCheckout)
    {
        List<OrderPC> orderPCs = new List<OrderPC>();
        XLDoc sldoc = new XLDoc();

        string localPath = @"C:\Temp\PCs.xlsx";

        Microsoft.Office.Interop.Excel.Application oXL=null;
        Microsoft.Office.Interop.Excel.Workbook mWorkBook=null;
        Microsoft.Office.Interop.Excel.Worksheet mWSheet1=null;
        Microsoft.Office.Interop.Excel.Range xlRange=null;
        try
        {
            oXL = new Microsoft.Office.Interop.Excel.Application();

            mWorkBook = oXL.Workbooks.Open(localPath);

            mWSheet1 = mWorkBook.Sheets[1];

            xlRange = mWSheet1.UsedRange;

            foreach (Microsoft.Office.Interop.Excel.Hyperlink hl in xlRange.Hyperlinks)
            {

               int y = hl.Range.Column;

                int z = hl.Range.Row;

                string vFilter = mWSheet1.Cells[z, y + 1].Value2.Trim();

                if (vFilter.CompareTo("Weekly") == 0)
                {
                    String baseUri = "http://xxx.yyy.net?";
                    int followUpIndex = baseUri.Length;
                    OrderPC orderPc = new OrderPC();
                    orderPc.ProductClass = hl.TextToDisplay.Trim();
                    orderPc.HyperLink = hl.Address.Trim().Substring(followUpIndex);
                    orderPc.SpecType = mWSheet1.Cells[z, y - 1].Value2.Trim();
                     if (mWSheet1.Rows[z].Cells[y + 3] != null || mWSheet1.Rows[z].Cells[y + 3].Value2 != string.Empty)
                        {
                            orderPc.ManufactureDate = mWSheet1.Cells[z, y + 3].Value2.ToString(); //Here is the error**
                        }
                    //Console.WriteLine(orderPc.ProductClass+"----"+orderPc.HyperLink);

                    orderPCs.Add(orderPc);
                }
            }
        }
        catch (Exception ex)
        {
        }
        finally
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();

            Marshal.FinalReleaseComObject(xlRange);
            Marshal.FinalReleaseComObject(mWSheet1);

            mWorkBook.Close(Type.Missing, Type.Missing, Type.Missing);
            Marshal.FinalReleaseComObject(mWorkBook);

            oXL.Quit();
            Marshal.FinalReleaseComObject(oXL);
        }
        return orderPCs;
    }

This excel file has 10 columns and I suppose I’m reading a valid cell. The error is **”

{Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)

“** I don’t have any clue since its COM. Help is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:54:01+00:00Added an answer on June 14, 2026 at 10:54 am

    Add another check

    if (mWSheet1.Cells[z, y + 3].Value2 != null)
    

    or convert to string using the following code, because it would not fail if Value2 is null

    orderPc.ManufactureDate = Convert.ToString(mWSheet1.Cells[z, y + 3].Value2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m getting system error when I try to compile the code below on Visual
I keep getting this error System.Web.HttpException was unhandled by user code Message=Validation of viewstate
i'm trying to open new Calc document, and i'm getting this error: System.IO.FileLoadException: Mixed
Getting system.entrypointnotfoundexception: loadlibrary While trying to use SevenZipLib.dll to uncompress the .7z file containing
at the moment im loading xml and i am getting error: System.Xml.XmlException: ' ',
We are getting this error: System.ServiceModel.ServerTooBusyException: The request to create a reliable session has
I am getting error of System.MissingMethodException after I have an optional parameter in one
I'm still new to code igniter and I'm having problems getting the login system
I am getting this 'HTTPS hostname wrong:' error when trying to connect to a
I am getting an error when trying to move my ASP.NET application from VS2010

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.