使用Excel VBA按网页上的链接

我把这个代码放到Minecraft.net的地方,input用户名和密码,然后进入configuration文件页面。 我需要更改该帐户的密码,该密码位于工作表的单元格A1中。 我似乎无法弄清楚如何点击更改密码链接。 这是我的代码到目前为止:

Dim IE As Object Sub submitFeedback3() Application.ScreenUpdating = False Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.Navigate "https://minecraft.net/login" Application.StatusBar = "Submitting" ' Wait while IE loading... While IE.Busy DoEvents Wend ' ********************************************************************** IE.Document.getElementById("username").Value = "dddddddd" IE.Document.getElementById("password").Value = "ddd" IE.Document.getElementById("signin").Click '********************************************************************** Application.StatusBar = "Form Submitted" Set IE = Nothing Application.ScreenUpdating = True End Sub 

如果click不起作用,那么你可以尝试提交HTML form

 ' Add reference to Microsoft Internet Controls ' Add reference to Microsoft HTML Object Library Set IE = New InternetExplorer IE.Visible = True IE.Navigate "https://minecraft.net/login" While IE.Busy DoEvents Wend IE.Document.getElementById("username").Value = "dddddddd" IE.Document.getElementById("password").Value = "ddd" Dim htmlForm As HTMLFormElement Set htmlForm = IE.Document.getElementById("loginForm") htmlForm.submit