自制的简易自动登录ACCESS软件网神器,借此顺便也感谢竹笛老师的引导!
VBA代码如下:
Option Compare Database
'Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'引用Microsoft HTML Object Library
'Microsoft Internet Controls
'VBA 启动IE代码
Private Sub Command4_Click()
'On Error Resume Next
Dim ie As InternetExplorer
Dim document, url As String
Set ie = CreateObject("InternetExplorer.application") '创建IE对象
url = "http://www.accessoft.com/login.asp"
ie.Visible = 1 '启动IE
ie.navigate url
Sleep 300 '延时0.3秒执行
Do While ie.busy or ie.readystate <> 4
Loop
Set document = ie.document
'document.getElementById("overridelink").Click
Do While ie.busy or ie.readystate <> 4
Loop
Set document = ie.document
document.getElementById("username").Value = Me.Text1
document.getElementById("password").Value = Me.Text2
'document.getElementById("logo").Click
'document.getElementById("Submit").Click '没有找到对象,没有起作用,需手动点击登录
End Sub
附 件:
点击下载此附件
图 示: