这里是按钮的HTML:如何使用excel vba编码来点击没有id,名称或类的网站上的按钮?
<div style = "position:absolute;top:2px;left:5px;"> == $0
<button title = "Start New Quote" style = "background-color:
rgb(4,61,111);
color:rgb(255,255,255); width:122px;height:33px;padding-
left:0px;padding-right:0px;font-size:12px;font-weight:bold;" onclick =
toggleNewBusinessMenu();
return false;"> == $0
<img style = "vertical-align: middle" src =
"/images/icons/create_quote.png"> == $0
"  Start Quote 
"
</button>
</div>
这里是一个选项我做过尝试,但新的编码所以不知道它应该如何在一个没有名字或ID的工作:
Sub Superior()
Dim ieApp As Object
'create a new instance of ie
Set ieApp = CreateObject("InternetExplorer.Application")
ieApp.Visible = True
ieApp.navigate "website"
Wait 1
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop
ieApp.document.all("login_email").Value = "username"
ieApp.document.all("login_password").Value = "password"
ieApp.document.all("login_button").Click
Wait 1
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop
ieApp.document.getElementsByTagName("$0").Click
End Sub
Sub Wait(Seconds)
CreateObject("WScript.Shell").Run "%COMSPEC% /c ping 127.0.0.1 -n " _
& Seconds + 1, 0, True
End Sub
我已经尝试了一切 - 谢谢!
你可以给出URL或分享问题和细节的更多信息 –
对于VBA,你能分享你编写的代码并提供URL吗?请 –
我编辑了我的帖子以澄清事情并向您显示我的代码。 –