如何用VBA点击网页上的button(名称隐藏)?

我的代码如下。 它打开浏览器,填写表单,但我不能让它点击button。 源中没有button名称或ID。

谢谢您的帮助。

梅利斯。

Dim htmlDoc As HTMLDocument Dim MyBrowser As InternetExplorer Sub ICON() Dim MyHTML_Element As IHTMLElement Dim MyURL As String MyURL = "http://icon.icon-mng.com/login/" Set MyBrowser = New InternetExplorer MyBrowser.navigate MyURL MyBrowser.Visible = True Do Loop Until MyBrowser.ReadyState = READYSTATE_COMPLETE Set htmlDoc = MyBrowser.document htmlDoc.all.login.Value = "xxx" htmlDoc.all.pass.Value = "xxx" For Each MyHTML_Element In htmlDoc.getElementsByTagName("input") If MyHTML_Element Like "submit" Then MyHTML_Element.Click: Exit For Next End Sub 

如果您提交表单尝试点击button,则会更好。

  With MyBrowser .document.forms(0).submit 'your login form is indexed 0. End With