How to change drop down value permanently

As I tried to create a automation for my company I stumbled across difficulty I cannot surpass. I have read many articles on this and other sites however I did not found answer.

So basically I have a dropdown list triggered by click on internet application my company uses. User has to change value from "Read" to "All" for 10 positions. And then application acknowledges the change and allows for form to be saved.

As I managed to write a code which clicks on specific field to activate a dropdown, and choose correct option from this dropdown. However when I loop it through all of those 10 dropdowns, not effect is visible.

There is a funny part. Whenever I put a breakpoint on "debug.print objinputs.outerHTML" and then allow for macro to continue the changes takes places and everything is allright. But without breakpoint something is wrong and all the values goes back to "Read". Have anyone knows what might be the issue here?

If you need any more informations please let me know.

    Set ifrm = Nothing
    Do Until ifrm.Length > 0
        Set ifrm = IE.Document.getElementsByTagName("iframe")(0).contentDocument.getElementsByTagName("iframe")(1).contentDocument.getElementsByTagName("iframe")(0).contentDocument.getElementsByTagName("iframe")(0).contentDocument.getElementsByTagName("tbody")(znacznik - 1).Document.getElementsByTagName("td")
    Counter = 1
    For Each ele In ifrm
        Worksheets("Test").Cells(Counter, 1) = ele.outerHTML
        Counter = Counter + 1
        If InStr(ele.outerHTML, "<td title=" & Chr(34) & "Read") Then
            Do Until Not ele.Busy And ele.readyState = READYSTATE_COMPLETE: Loop

            Set objInputs = Nothing
            Set objInputs = IE.Document.getElementsByTagName("iframe")(0).contentDocument.getElementsByTagName("iframe")(1).contentDocument.getElementsByTagName("iframe")(0).contentDocument.getElementsByTagName("iframe")(0).contentDocument.getElementsByTagName("tbody")(znacznik - 1).Document.getElementsByTagName("select")(3)

            objInputs.Value = "All"
            Debug.Print objInputs.Value

            Do Until Not IE.Busy And IE.readyState = READYSTATE_COMPLETE: Loop

        End If

1 answer

  • answered 2017-10-11 10:58 KamilG

    I found a solution. It is not the most elegant one but it works and is correct enough for my needs.

    I have added

      CreateObject("WScript.Shell").Popup "Just Wait", 1, "Waiting"

    after value change and it did the trick. I would love to know why does it happen, and why does this "trick" solves the issue.