+ Reply to Thread
Results 1 to 5 of 5

Set FillHistory as iedoc.getElementsByName("name) fail randomly

  1. #1
    Registered User
    Join Date
    10-18-2013
    Location
    Arlington, Texas
    MS-Off Ver
    Excel 2007
    Posts
    60

    Set FillHistory as iedoc.getElementsByName("name) fail randomly

    * i am sorry if i post this twice. something happen and i can't find my first post after i posted *

    Hello,
    I am pretty new at VBA and still try to learn. I inherit this VBA code at work from previous employee that is no longer with the department. The code work most of the time but at time it randomly just stop/break. I have been trying to find a fix for the past 2 weeks and have not luck. Can someone please help.

    i've have tried several thing but have no luck.

    do i need to declare some of the value in order for it to work all the time?


    Please see the code below:
    ===========================================================================================================================
    Private Sub Test(ByRef myie As SHDocVw.InternetExplorer)
    Set iedoc = myie.Document
    Dim Fill As HTMLTableCell


    QMSI = False

    Call NextScreen(myie)
    While myie.busy
    DoEvents
    Wend

    ' I tried to replace the above "While myie.busy - DoEvents - Wend" with While myie.busy Or myie.readystate <> 4: DoEvents: Wend this but no good
    ' I even tried put a Do While loop "Do - Set FillHistory = iedoc.getElementsByName("fill_seg") - While iedoc.getElementsByName("fill_seg") <> 0" but also no good

    ' the code break here (per debug.print) right before the Set statement.
    'Do I need to delcare "FillHistory" As HtmlElementCollection and "lookqmis" as String or something else?

    Set FillHistory = iedoc.getElementsByName("fill_seg")
    ' I place a debug.print for FillHistory here and nothing happen only a blank when the code break

    For Each Fill In FillHistory(0)

    lookqmis = Fill.innerText
    If InStr(1, lookqmsi, "open") <> 0 Then
    'my routine
    QMSI = True
    End If
    Next

    End Sub
    ==========================================================================

    thank you for your help.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Set FillHistory as iedoc.getElementsByName("name) fail randomly

    n07cn3,
    Please wrap your code with code tags as per forum's rule.
    I think you posted part of the code. It is difficult to comment on the code with out testing it and for that we need URL. I suspect this is internal site or secured site.

  3. #3
    Registered User
    Join Date
    10-18-2013
    Location
    Arlington, Texas
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Set FillHistory as iedoc.getElementsByName("name) fail randomly

    is this it?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Set FillHistory as iedoc.getElementsByName("name) fail randomly

    No, ULR is the website address- it could be public or private (Intranet). We need to see the source view code, which could be found by right clicking on any page of the site, or hit F12. This will show us how the DOM- all the HTML elements you need in order to extract data. With out seeing it, we do not know how the code works and why it does not.

  5. #5
    Registered User
    Join Date
    10-18-2013
    Location
    Arlington, Texas
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Set FillHistory as iedoc.getElementsByName("name) fail randomly

    sorry i can't upload the source code.

    the code work fine more than 95% of the time. i use it through out the day maybe 300 to 400 times a day. some day the code just stop once and on other days it stop several times with in an hour.

    please see my comment in the code above.

    1) can you please tell me at least if i should declare "FillHistory" and "lookqmis"? if so, what should i declare these as

    2) can you explain to me what is the significant or what does the "(0)" do in the line "For Each Fill In FillHistory(0)"?

    thank you for your help.

+ 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. How to make a cell display "FAIL" when range of cells is FAIL
    By crazychile in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-18-2017, 04:13 PM
  2. Replies: 11
    Last Post: 04-17-2017, 12:17 PM
  3. Update Macro to search column Bfor "Fail" and "Exception"
    By programct in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2014, 02:32 PM
  4. Why does this "wait for page to load" fail?
    By hgtenn in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-04-2014, 01:54 PM
  5. [SOLVED] Formula needed to display "Pass" or "Fail" if a column contains any values other than "yes
    By andreindy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-26-2013, 05:49 PM
  6. Close WB "Select Method Range Class Fail"
    By konichiwa in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-28-2011, 05:09 AM
  7. [SOLVED] Why does Outlook.Application.GetNamespace(&amp;quot;MAPI&amp;quot;) Fail?
    By Lee in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-27-2005, 10: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