使用VBA从网页“ POP UP”表捕获数据

时间:2019-11-28 13:30:14

标签: excel vba automation

Source = "https://otcportal.tax.ok.gov/gpx/gp_PublicSearchPUNbyLegal.php"
objIE.Navigate Source

Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop

Set ele2 = objIE.document.getElementsByTagName("input")

For Each opt In ele2
    If opt.getAttribute("value") = "PUN" Then
        opt.Focus
        opt.Click
        Exit For
    End If
Next opt

Application.Wait (Now + TimeValue("00:00:3"))
Set ele3 = objIE.document.getElementsByTagName("input")

For Each opt In ele3
    If opt.getAttribute("name") = "OTCtxtPUN" Then
        opt.Focus
        opt.Value = "073-055988-0-0000"
        Exit For
    End If
Next opt

Application.Wait (Now + TimeValue("00:00:3"))
Set ele = objIE.document.getElementsByTagName("input")

For Each opt In ele
    If opt.getAttribute("name") = "submit" Then
        opt.Focus
        opt.Click
        Exit For
    End If
Next opt

Application.Wait (Now + TimeValue("00:00:3"))
Set ele5 = objIE.document.getElementsByTagName("a")
For Each opt In ele5
    If opt.getAttribute("class") = "showDetails" Then
        opt.Focus
        opt.Click
        Exit For
    End If
Next opt

Application.Wait (Now + TimeValue("00:00:5"))
i=i+1    
loop

End Sub

弹出表格

现在,在运行这段代码的最后,我得到了一个弹出表,其中包含一些位于不同选项卡中的数据。如何从excel中的每个选项卡捕获所有数据?

0 个答案:

没有答案