操作IE的问题
有个操作IE的语句
- VB code
Dim IESet IE = CreateObject("Internetexplorer.application") '建立 连接 浏览器IE.Visible = True ' 浏览器 是否可见,可以为数据 1 = true , 0 = falseIE.Navigate "http://148.36.20.220:86/" ' 导航 制定的 网址'IE.gohome '这个是打开主页Do While IE.readystate <> 4 ' 这个是 判断 浏览器打开的网页是否装载 完全LoopIf IE.LocationURL = "http://148.36.20.220:86/" ThenIE.Document.Forms(0).elements("TextBox2").Value = "888888" ' 设置表单值IE.Document.Forms(0).elements("TextBox1").Value = "chenlin3" '同上IE.Document.Forms(0).elements("Button1").Click '模拟点击表单ElseIf IE.LocationURL = "http://148.36.20.220:86/qd.aspx" ThenMsgBox "ddddddddddddddddddddddddddddddd"End IfIE.quit ' 退出'Set IE = Nothing '销毁 ie对象 就是释放内存 是个好习惯[解决办法]
循环里加DoEvents
[解决办法]
Dim IE和Dim s
放在所有代码的最上面的"通用"里声明,因为其使用跨越了sub
新的问题发新的帖子,否则别人未必注意到
[解决办法]
[解决办法]
你确定网页中有TextBox2才可以这么用,并且还必须在Forms(0)里面
[解决办法]
该不会是VB用多了认为HTML中的input名字都是TextBox、Button吧。。。