Closed Thread
Results 1 to 4 of 4

Runtime Error 91 Object Variable or With Block not Set

  1. #1
    Registered User
    Join Date
    05-20-2015
    Location
    England
    MS-Off Ver
    2007
    Posts
    12

    Runtime Error 91 Object Variable or With Block not Set

    Hi,

    I am new to this forum and to VBA in general.

    I am getting the above error when I run my VBA code in full. It doesn't happen when I use the debug and step into.

    When running the code, the debug hightlights this line in the code., Range("C" & rw).Value = doc.getElementById("routeDistanceValue").innerHTML

    I would be grateful if someone could point me in the right direction or suggest a way to get around the error.

    Many thanks
    Alan

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Runtime Error 91 Object Variable or With Block not Set

    Hello wkddj51,

    You're mostly likely automating Internet Explorer with VBA. The problem is caused by a lack of synchronization between the IE application and the VBA environment.

    There are ways to deal with this issue. Usually, I will not use Internet Explorer but sometimes it is unavoidable. To help with this problem, we need to see what code you have. If can post a copy of your workbook then that would be best.

    Please redact any sensitive or confidential information before you post the workbook.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    05-20-2015
    Location
    England
    MS-Off Ver
    2007
    Posts
    12

    Re: Runtime Error 91 Object Variable or With Block not Set

    Hi Leith,

    Thank you for your reply and I attached a sample file with code. The data is a good representation of the data in the larger file(about 2,500)

    I am still getting the above error so any assistance or point the right direction will be very welcome.

    Also, I am not sure if I have handled correctly the If statement for checking the From Postcode column for existence of data.

    Again, thanks in advance. I appreciate all help.

    Kind regards
    Alan
    Attached Files Attached Files

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Runtime Error 91 Object Variable or With Block not Set

    Thread closed,As per forum rules(Op posted in Commercial sub forum.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Runtime Error "91" - Object Variable or With Block Variable not set
    By damidre in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-05-2013, 04:45 AM
  2. Runtime Error 91 - object variable or with block variable not set
    By 0celj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2013, 09:40 PM
  3. runtime error 91 object variable or With block variable not set
    By tullemann in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2011, 01:27 PM
  4. Replies: 8
    Last Post: 02-17-2009, 02:24 PM
  5. Runtime error 91 - Object variable or with block variable not set
    By Christian411 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-04-2008, 08:05 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