none
Fatal error trying to read data from and Excel file RRS feed

  • Question

  • Hi,

    Trying to read an Excel worksheet and I get this error message:

    A fatal error has occured and debugging needs to be terminated. For more details please see the Microsoft Help and Support web site.

    HRESULT=0x80131c08 Error code = 0x0

    The error occurs on the last command of this piece of vb.Net code:

    Dim ws As Microsoft.Office.Interop.Excel.Worksheet
    Dim rngKey As Microsoft.Office.Interop.Excel.Range
    rngKey = ws.Range("A2")

    Thanks,

    Ruwel

    Tuesday, February 5, 2013 10:41 AM

Answers

  • Damian

    It seems to be a memory recource problem. I'm working on a virtual developement server.

    I monitored memory and CPU during the execution and saw it was to te ceiling.

    After assigning more memory, the problem ceased to occure.

    Thanks anyway

    RuWel

    • Marked as answer by RuWel Tuesday, February 5, 2013 3:00 PM
    Tuesday, February 5, 2013 3:00 PM

All replies

  • where do you actually assign ws variable? i see only declaration and right after that you dereference it.
    Tuesday, February 5, 2013 11:16 AM
  • Hi DamianD, thanks for responding.

    I simplified the code to get to the right issue.

    This is a bit more elaborated code:

    For Each ws As Microsoft.Office.Interop.Excel.Worksheet In MyWorkBook.Worksheets

          

           Dim rngKey As Microsoft.Office.Interop.Excel.Range

          

    rngKey = ws.Range("A2")

          

    Next ws

    RuWel

    Tuesday, February 5, 2013 12:33 PM
  • add try/catch block around it, maybe you let some exception escape.
    Tuesday, February 5, 2013 1:13 PM
  • I actualy have a Try/catch around it

    but when I get the value in the immediate window with:

    ?ws.Range("A2").Value I do get the value of that cell.

    the error occurs when I try to evaluate the object ws.Range("A2") it self

    RuWel

    Tuesday, February 5, 2013 1:19 PM
  • maybe this range does not exist in that worksheet - anyway, this error is actually from VS side, not excel. Try to clear and close all 'variables' windows like Locals, Watch, etc. and do not use immediate window to evaluate calls - just follow debugger steps and see if you get exception.
    Tuesday, February 5, 2013 1:28 PM
  • The range does exist.

    But it takes 4-5 minutes to evaluate rngKey = ws.Range("A2")
    and then a dialog box with the indicated error pops up.

    The error is NOT catched by the Try Catch

    RuWel

    Tuesday, February 5, 2013 1:45 PM
  • so, without VS attached problems does not occur?
    • Marked as answer by RuWel Tuesday, February 5, 2013 2:55 PM
    • Unmarked as answer by RuWel Tuesday, February 5, 2013 2:55 PM
    Tuesday, February 5, 2013 2:08 PM
  • Damian

    It seems to be a memory recource problem. I'm working on a virtual developement server.

    I monitored memory and CPU during the execution and saw it was to te ceiling.

    After assigning more memory, the problem ceased to occure.

    Thanks anyway

    RuWel

    • Marked as answer by RuWel Tuesday, February 5, 2013 3:00 PM
    Tuesday, February 5, 2013 3:00 PM