+ Reply to Thread
Results 1 to 4 of 4

VBA Code runtime error only after opening Locals window

  1. #1
    keeena
    Guest

    VBA Code runtime error only after opening Locals window

    I have an odd problem and was wondering if anyone had some insight to
    my issue. I have some code which appears to run perfectly fine under
    normal conditions. I can run multiple iterations w/ no issues what so
    ever.

    However, if I...
    - pause code execution
    - view Locals
    - expand the Locals tree to view a variable that is an instance of my
    own class
    - then attempt to resume execution
    ....the code will fail with Error 91 (Object variable or With block
    variable not set)

    Furthermore, if I click on Debug in the error window, no failure point
    is highlighted in the code (side note - I do have the debug option to
    break in Class Modules). Code remains in the break state.

    My code is somewhat complex so I'll hold off on posting the code for
    now. What I initially want to know is if there is a common
    explaination for this type of failure. I'm hoping that will point me
    in the right direction so I can find the problem.

    One more point - I am using the published hack to create my own
    collection classes (actually, I have a heirarchy of collection
    classes). The code fails only when I expand the expression which is an
    instance of my collection class.

    I am using Excel 2003 SP2.

    Thanks,
    -K


  2. #2
    keeena
    Guest

    Re: VBA Code runtime error only after opening Locals window

    One more tidbit of info...

    If I place a statement right before the end of the routine (e.g.
    debug.print "Junk"), this statement will be executed prior to the Error
    91. So the error is thrown after all my code has run.

    I explicitly dereference all objects prior to this debug.print
    statement. So the error is being thrown when VBA is performing its own
    stuff (cleanup?) behind the scenes at or after the End Sub statement.
    Why is this happening and how could I debug this further?

    TIA,
    -K


  3. #3
    keeena
    Guest

    Re: VBA Code runtime error only after opening Locals window

    One more tidbit of info...

    If I place a statement right before the end of the routine (e.g.
    debug.print "Junk"), this statement will be executed prior to the Error
    91. So the error is thrown after all the code has run.

    I explicitly dereference all objects prior to this debug.print
    statement. So the error is being thrown when VBA is performing its own
    cleanup. How could I debug this further?

    TIA,
    -K


  4. #4
    keepITcool
    Guest

    Re: VBA Code runtime error only after opening Locals window


    Check VBE/tools/options
    Tab:General
    Break in Class module must be activated.

    I assume an error is thrown in one of the property get procedures
    that you fail to pick up.

    Cant analyse without seeing the code. Just went into 1 of my own multi
    hierarchy classes and had no problems. expanding and collapsing to my
    heart's content

    you can mail me the book and i'll have a look.
    (pls zip and mention excel version..)

    my email is my signature below.
    just add @ and . around chello (or rot13 the sender address)

    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    keeena wrote in
    <news:<1140624505.547230.201190@f14g2000cwb.googlegroups.com>

    > One more tidbit of info...
    >
    > If I place a statement right before the end of the routine (e.g.
    > debug.print "Junk"), this statement will be executed prior to the
    > Error 91. So the error is thrown after all the code has run.
    >
    > I explicitly dereference all objects prior to this debug.print
    > statement. So the error is being thrown when VBA is performing its
    > own cleanup. How could I debug this further?
    >
    > TIA,
    > -K


+ 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