+ Reply to Thread
Results 1 to 7 of 7

Run-time error '91' - Object variable or With block not set // getting HTML elements of we

  1. #1
    Registered User
    Join Date
    02-02-2014
    Location
    Luxembourg
    MS-Off Ver
    Excel 2010
    Posts
    4

    Run-time error '91' - Object variable or With block not set // getting HTML elements of we

    Hello every one,

    I have a very strange problem with my code. I in my 1st Excel sheet a list of links and a function that loops through those links and sends them to another function that lists the HTML content on my second sheet.

    function sheet 1:
    Please Login or Register  to view this content.
    function sheet 2:
    Please Login or Register  to view this content.
    Now to my specific problem.

    When I run the code I have a Run-time error '91' - Object variable or With block not set error which appears randomly and I don't know where it comes from. But what is really strange is that if y set a Breakpoint and run the whole program step by step no Run-Time error appears and all goes well.

    Does anyone have an idea why? Thank you in advance.

  2. #2
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Run-time error '91' - Object variable or With block not set // getting HTML elements o

    Do you have several reverences set?
    Normally I open the IE like :
    Please Login or Register  to view this content.

    Maybe its easier when you provide an example workbook.

  3. #3
    Registered User
    Join Date
    02-02-2014
    Location
    Luxembourg
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Run-time error '91' - Object variable or With block not set // getting HTML elements o

    Thanks for the quick reply Gerard

    Well I checked it on the internet as I have never used html those functions in VBA before but if your version is working I'm fine with it.
    Here is my workbook with test links and stuff. Maybe the error is just coming from me.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Run-time error '91' - Object variable or With block not set // getting HTML elements o

    Ok, did step trough the code and didn't got any error.....

    So ran the code and indeed got an error....
    There must be a problem with opening the IE and closing it again.
    So I figured that an pause could make the difference.

    Somehow the Browser.readyState = READYSTATE_COMPLETE isn't catching all

    Put the wait code after opening the IE

    Please Login or Register  to view this content.
    May be playing with the time, 1 second is still a problem for me. On 2 seconds it gave no error.
    I think the problem is revering to an object on the IE page.
    Last edited by G e r a r d; 02-02-2014 at 10:35 AM.

  5. #5
    Registered User
    Join Date
    02-02-2014
    Location
    Luxembourg
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Run-time error '91' - Object variable or With block not set // getting HTML elements o

    Thank you Gerard, indeed your solution works fine.

    I hate not to know why it brings us this error makes me crazy.
    Anyway Thank you again for your help Gerard.

  6. #6
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Run-time error '91' - Object variable or With block not set // getting HTML elements o

    Your welcome
    If problem is solved set tread [Solved] and if you like the answer grand it a *Add reputation......

  7. #7
    Registered User
    Join Date
    02-02-2014
    Location
    Luxembourg
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Run-time error '91' - Object variable or With block not set // getting HTML elements o

    Done thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 04-16-2013, 07:15 AM
  2. Run-time error '91': - Object variable or With block variable not set (HELP!)
    By darrenkaye in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2013, 05:24 PM
  3. Replies: 6
    Last Post: 12-21-2012, 08:03 AM
  4. Replies: 1
    Last Post: 09-25-2012, 08:03 PM
  5. [SOLVED] Intermittent Run-time Error 91: Object Variable or With Block variable not set
    By fraanchtoast in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-29-2012, 10:11 AM

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