第一种方法 InternetExplorer.Application
复制代码代码如下:
StartURL = "www.vevb.com"
set IE = CreateObject("InternetExplorer.Application")
IE.Visible = true
IE.Navigate StartURL
第二种方法 WScript.Shell 复制代码代码如下:
dim Wsh
Set Wsh=WScript.CreateObject("WScript.Shell")
On error Resume Next
Wsh.Run "www.vevb.com"
下面的代码就是自动打开百度并输入武林网进行搜索的代码 复制代码代码如下:
Dim wsh,ie
Set wsh = CreateObject("wscript.shell")
Set ie = WScript.CreateObject("InternetExplorer.Application")
URL=" http://www.baidu.com"
code="武林网"
ie.visible = True
ie.navigate URL
WScript.Sleep 1000
wsh.AppActivate "百度一下,你就知道 " ' 引号中填浏览器最上面的标题
wsh.Run "cmd.exe /c echo " & code & "| clip.exe", vbHide
wsh.SendKeys "^v"
wsh.SendKeys "{ENTER}"
复制代码代码如下:
Dim wsh,ie
Set wsh = CreateObject("wscript.shell")
Set ie = WScript.CreateObject("InternetExplorer.Application")
URL=" http://www.baidu.com"
ie.visible = True
ie.navigate URL
WScript.Sleep 1000*5
wsh.AppActivate " " ' 引号中填浏览器最上面的标题
WScript.Sleep 1000*1
wsh.SendKeys "帐号" '引号中填帐号
WScript.Sleep 1000*1
wsh.SendKeys "{TAB}"
WScript.Sleep 1000*1
wsh.SendKeys "密码" '引号中填密码
WScript.Sleep 1000*1
wsh.SendKeys "{ENTER}"