访问网页并自动填写表单VBA

Sub Macro1()
'
'CreateObject ("internetExplorer.application")
'Visible = True
'Navigate "C:\Program Files (x86)\Internet Explorer\Application\iexplore.exe"

'
MsgBox ("123")

  
  CreateObject ("internetExplorer.application")
  Navigate "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
  
End Sub

Sub Macro2()
'
' Macro2 Macro
'

'
CreateObject ("internetExplorer.application")
Navigate ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
End Sub

Sub Macro3()
'
' Macro3 Macro

 'Url = "www.baidu.com"
 Url = "https://login.10086.cn/login.html?channelID=12034&backUrl=http%3A%2F%2Fwww.10086.cn%2Findex%2Ffj%2Findex_591_591.html"
 Shell "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe " & Url, vbNormalFocus
 'Shell "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
End Sub
Sub Macro4()
'
' Macro4 Macro
'
 'Url = "http://www.exceltip.net/thread-49609-1-1.html"
 'Url = "http://www.baidu.com"
 With ie
 Url = "https://login.10086.cn/login.html?channelID=12034&backUrl=http%3A%2F%2Fwww.10086.cn%2Findex%2Ffj%2Findex_591_591.html"
 ActiveWorkbook.FollowHyperlink Url
 'IE.document.forms(sms_login_1).submit
 
 'IE.document.getElementById(sms_login_1).Click
 'ActiveSheet.WebBrowser1.Document.getElementById(sms_login_1).Click
 'IE.Document.GetElementById(sms_login_1).Click

 End With
End Sub
Sub Macro5()
'
' Macro5 Macro
'

'

 With ie
'Set ie = CreateObject("InternetExplorer.application")
 Url = "https://login.10086.cn/login.html?channelID=12034&backUrl=http%3A%2F%2Fwww.10086.cn%2Findex%2Ffj%2Findex_591_591.html"
 Shell "C:\Program Files (x86)\Internet Explorer\iexplore.exe " & Url, vbNormalFocus

ie.Visible = True
ie.Navigate "https://login.10086.cn/login.html?channelID=12034&backUrl=http%3A%2F%2Fwww.10086.cn%2Findex%2Ffj%2Findex_591_591.html"
ie.document.GetElementsByName("p_name").Value = "123"
ie.document.GetElementsByName("p_pwd").Value = "test"
ie.document.GetElementsByName("submit_bt").Click

 End With
'ie.document.forms(0).all("sms_login_1").Value = "test"

End Sub

你可能感兴趣的:(VBA)