Sub 关闭登录框() On Error Resume Next With CreateObject("internetexplorer.application") .Visible = True .Navigate "http://www.xiaomi.com/" Do Until .ReadyState = 4 DoEvents Loop .document.getElementById("header_menu_top_login").All.tags("a")(0).Click t1 = Timer Do Until Timer > t1 + 2 DoEvents Loop Set r = .document.All.tags("a") For i = 0 To r.Length - 1 If r(i).classname = "close" Then r(i).Click Exit For End If Next i '.Quit End With End Sub
On Error Resume Next
With CreateObject("internetexplorer.application")
.Visible = True
.Navigate "http://www.xiaomi.com/"
Do Until .ReadyState = 4
DoEvents
Loop
.document.getElementById("header_menu_top_login").All.tags("a")(0).Click
t1 = Timer
Do Until Timer > t1 + 2
DoEvents
Loop
Set r = .document.All.tags("a")
For i = 0 To r.Length - 1
If r(i).classname = "close" Then
r(i).Click
Exit For
End If
Next i
'.Quit
End With
End Sub