Private Sub Form_Load()
Dim ie As InternetExplorer
Dim sWind As ShellWindows
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate ("http://www.baidu.com/")
End SubPrivate Sub Timer1_Timer()
On Error Resume Next
Set sWind = New ShellWindows
For Each ie In sWind
If ie.Busy = False Then
If LCase(Mid(ie.locationURL, 1, 4)) <> "file" Then
If ie.locationURL = "http://www.baidu.com/" Then
Print ie.document.documentElement.outerHTML
'ie.document.getElementById("TextBox1").Value = "chenlin3"
' ie.document.getElementById("TextBox2").Value = "888888"
' ie.document.getElementById("Button1").Click
End If
End If
end ifNext
End Sub这个时候怎么得到IE的源码?pDisp.document.documentElement.outerHTML在WEBBROWSER中是可以的,到这儿却不行了
Dim ie As InternetExplorer
Dim sWind As ShellWindows
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate ("http://www.baidu.com/")
End SubPrivate Sub Timer1_Timer()
On Error Resume Next
Set sWind = New ShellWindows
For Each ie In sWind
If ie.Busy = False Then
If LCase(Mid(ie.locationURL, 1, 4)) <> "file" Then
If ie.locationURL = "http://www.baidu.com/" Then
Print ie.document.documentElement.outerHTML
'ie.document.getElementById("TextBox1").Value = "chenlin3"
' ie.document.getElementById("TextBox2").Value = "888888"
' ie.document.getElementById("Button1").Click
End If
End If
end ifNext
End Sub这个时候怎么得到IE的源码?pDisp.document.documentElement.outerHTML在WEBBROWSER中是可以的,到这儿却不行了
Dim sWind As ShellWindowsie,sWind 至少应定义成窗体级全局变量
Dim ie As InternetExplorer
Dim sWind As ShellWindows
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate ("http://www.baidu.com/")
End SubPrivate Sub Timer1_Timer()
On Error Resume Next
Dim sWind, ie
Set sWind = New ShellWindows
For Each ie In sWind
If ie.Busy = False Then
If LCase(Mid(ie.locationURL, 1, 4)) <> "file" Then
If ie.locationURL = "http://www.baidu.com/" Then
Print ie.document.documentElement.outerHTML
MsgBox ie.document.documentElement.outerHTML
'ie.document.getElementById("TextBox1").Value = "chenlin3"
' ie.document.getElementById("TextBox2").Value = "888888"
' ie.document.getElementById("Button1").Click
End If
End If
End IfNext
End Sub有用的
Print Now & "--" & ie.document.documentElement.outerHTMLOption ExplicitPrivate Sub Form_Load()
Dim ie As InternetExplorer
Dim sWind As ShellWindows
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate ("http://www.baidu.com/")
End SubPrivate Sub Timer1_Timer()
On Error Resume Next
Dim sWind, ie
Set sWind = New ShellWindows
For Each ie In sWind
If ie.Busy = False Then
If LCase(Mid(ie.locationURL, 1, 4)) <> "file" Then
If ie.locationURL = "http://www.baidu.com/" Then
Me.Cls
Print Now & "--" & ie.document.documentElement.outerHTML
'MsgBox ie.document.documentElement.outerHTML
'ie.document.getElementById("TextBox1").Value = "chenlin3"
' ie.document.getElementById("TextBox2").Value = "888888"
' ie.document.getElementById("Button1").Click
End If
End If
End IfNext
End Sub
再说PRINT是从上往下打印,一个窗体就这么小,一个网页内容要几个窗体这么高才能显示下来,所以只能每次CLS清空一下