In excel or word, paste the following code into a vba normal module and run it. The code goes to a public web site and tries to lookup a school. The website pops up a "message from webpage" dialog that warns me that the the school
number is not valid.
My program can detect that popup, but how can I reliably and automatically dismiss it?
I have a workaround that uses sendkeys but about 10% of the time the popup remains.
Does anybody have a solution that does NOT require sendkeys? The ideal solution would also work when objie.visible = false.
option Explicit Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Sub t1022() Dim objie As Object Dim i As Long Dim htmlTable As htmlTable ' set reference to microsoft html object library Set objie = CreateObject("InternetExplorer.Application") objie.Visible = True objie.navigate "http://www.slforms.universalservice.org/Form471Expert/471StatusCheck.aspx" Do: Sleep 100: Loop While objie.busy Set htmlTable = objie.Document.getElementsByName("txtBenId")(0) htmlTable.Value = 12345 With objie.Document.getElementById("txtFundingYear") .Click .Value = 2013 End With objie.Document.getElementById("btnSearch").Click For i = 1 To 10 Sleep 100 If Not objie.busy Then Exit For Next i If objie.busy Then MsgBox "popup detected" End If End Sub