【发布时间】:2019-04-29 14:11:33
【问题描述】:
我是初学者和非技术人员,我完全卡在这里
我想使用 VBA 点击新建项目按钮
这是新项目按钮的检查元素
<button tabindex="0" class="xui-button xui-button-create xui-button-small" type="button" data-automationid="project-modal-new-button">New project</button>
下面是代码,到目前为止我已经创建,它运行没有任何问题,它将带我从项目选项卡进入项目选项卡我需要使用 VBA 单击新的项目按钮
Sub Xero()
Dim i As SHDocVw.InternetExplorer
Set i = New InternetExplorer
i.Visible = True
i.navigate ("https://login.xero.com/")
Do While i.readyState <> READYSTATE_COMPLETE
Loop
Dim idoc As MSHTML.HTMLDocument
Set idoc = i.document
idoc.all.UserName.Value = "XXXXX"
idoc.all.Password.Value = "123"
Dim ele As MSHTML.IHTMLElement
Dim eles As MSHTML.IHTMLElementCollection
Set eles = idoc.getElementsByTagName("button")
For Each ele In eles
If ele.ID = "submitButton" Then
ele.Click
Application.Wait (Now + TimeValue("0:00:10"))
Else
End If
Next ele
i.navigate ("https://projects.xero.com/?CID=!QhJgj")
Do While i.readyState <> READYSTATE_COMPLETE
Loop
End Sub
我想点击新建项目按钮进一步移动
【问题讨论】:
标签: html excel vba web-scraping