+ Reply to Thread
Results 1 to 5 of 5

VBA to IE - Works in step through, not when run

  1. #1
    Registered User
    Join Date
    05-14-2013
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    78

    VBA to IE - Works in step through, not when run

    Hi Everyone,

    I am having some issues running some vb to go to the internet and fill out a form based on what i have in my excel. I'm hoping someone can help me out with what i'm doing incorrectly.

    In column a i have client name, date from, date to, and utilization. I fill out the first three items in column b, and im trying to get it to return the utilization.

    The code below works perfectly when i step through it (F8), but when i just run it directly it completely skips through the part where it is supposed to input the data into the text fields. Can anyone identify why it would do that?

    Please Login or Register  to view this content.
    Thanks for the help!

  2. #2
    Registered User
    Join Date
    05-14-2013
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    78

    Re: VBA to IE - Works in step through, not when run

    It looks like even if i put a breakpoint in at the for each ie_element part and then hit F5 again it will work. what could be causing it to zoom past it when normally run?

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

    Re: VBA to IE - Works in step through, not when run

    Hello bruizer31,

    The problem is one of synchronization between VBA and Internet Explorer. VBA starts Internet Explorer asynchronously. That is once Internet Explorer is started, VBA returns and continues executing code.

    To get them in sync, loops are needed to check certain conditions have been met before VBA continues on. Using a set delay will work but not reliably.

    I have made some changes to your code and added annotations.
    Please Login or Register  to view this content.
    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!)

  4. #4
    Registered User
    Join Date
    05-14-2013
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    78

    Re: VBA to IE - Works in step through, not when run

    thanks, this works very well so far. Could you point me in the right direction to be able to grab the inner text of a <td> tag? It doesn't have a tag name or anything, but it is the 9th instance of the tag that i am trying to retrieve.

    Appreciate your help!

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

    Re: VBA to IE - Works in step through, not when run

    Hello bruizer31,

    The TD tag or Table Data, belongs to s specific row TR of a given table TABLE. If there is only table you could do this...
    Please Login or Register  to view this content.
    Getting the text may be a bit trickier. Table cells can hold more than text. If it contains only text then this would work...
    Please Login or Register  to view this content.
    If there are other tags in the cell then more parsing would be need to extract the all of the text or just the inner most text.

+ 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. [SOLVED] Macro works in step through but not when run
    By bruizer31 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2013, 05:50 PM
  2. Macro run fails, step through works.
    By SteveAlston in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2009, 11:37 PM
  3. [SOLVED] It works when I step through it but it won't run
    By chillihawk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2006, 06:15 PM
  4. [SOLVED] macro works differently when using the Step Into (F8) feature
    By Dave Y in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-23-2005, 11:05 PM

Tags for this Thread

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