Office中国论坛/Access中国论坛
标题:
VBA打开网站
[打印本页]
作者:
access8009
时间:
2008-6-30 13:04
标题:
VBA打开网站
Option
Explicit
Public
Declare
Function
ShowWindow&
Lib
"user32" _
(
ByVal
hwnd
As
Long
,
ByVal
nCmdShow
As
Integer
)
Private
Sub
LoginWEB()
Dim
ie
As
Object
On
Error
GoTo
1
Set
ie = CreateObject("InternetExplorer.Application")
With
ie
.navigate "http://www.baidu.com/login.php"
Do
While
.ReadyState <> 4:
Loop
With
.Document.Forms(3)
.Loginname.Value = "
用户名"
.Loginpass.Value = "密码"
.buttlogin.Click
End
With
Do
While
CBool
(InStrB(1, .Document.url, "http://
www.baidu.com
/login.php"))
DoEvents:
Loop
Do
While
CBool
(InStrB(1, .Document.url, "http://
www.baidu.com
/exit.php"))
DoEvents:
Loop
Call
ShowWindow(.hwnd, 3)
.Visible =
True
End
With
Set
ie =
Nothing
Exit
Sub
1:
MsgBox "非预期错误, sorry."
ie.Quit
Set
ie =
Nothing
End
Sub
作者:
tanhong
时间:
2008-6-30 14:38
不错!不错!照收不误.哈哈[:32]
作者:
rjacky
时间:
2008-6-30 16:22
支持一下
作者:
huangqinyong
时间:
2008-6-30 23:17
支持一下。
作者:
beenet
时间:
2008-6-30 23:26
我们公司的系统都是.do结尾的,submit都不能用,表单但能填写。
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3