VBA代码单击所需网页上的按钮

时间:2016-08-04 14:46:07

标签: vba

我需要能够通过vba单击按钮。有人可以帮我代码吗?出于某种原因,我很难完成这项工作。我会非常感激任何帮助。谢谢。

<input type="submit" class="Button_PartnerStyle" value="TRACK IT" onclick="checkVariables()">
    Set arr = ie.Document.getElementsByClassName("Button_PartnerStyle")
    For Each a In arr
        a.Click
    Next a
    Do Until ie.Document.ReadyState = "complete"
    Loop
    Set arr = ie.Document.getElementsByClassName("Button_PartnerStyle")
    For Each a In arr
        If a.Value = "TRACK IT" Then
            a.Click
            Exit For
        End If
    Next a
    Do Until ie.Document.ReadyState = "complete"
    Loop
    Set arr = ie.Document.getElementsByName("Type")
    For Each a In arr
        If a.Value = "submit" Then
            a.Click
            Exit For
        End If
    Next a
End Sub

1 个答案:

答案 0 :(得分:0)

以这种方式试试。

http://vbadud.blogspot.com/2009/08/how-to-login-to-website-using-vba.html

这行代码是关键。

# In the new notebook
connect_to 'exisiting_notebook_name' # get access to the existing notebook
df.describe()
# ...
# some additional analysis works