首先引入 Microsoft HTML Object Library:Dim WithEvents x As HTMLDocument
Dim oh As HTMLDocument
Private Sub Command1_Click()
Set x = New HTMLDocument
Set oh = x.createDocumentFromUrl("http://www.applevb.com/index.html", "null")
End SubPrivate Sub x_onreadystatechange()
If x.readyState = "complete" Then
Debug.Print "abcd"
If Not oh.body Is Nothing Then
Debug.Print oh.body.outerText
End If
End If
End Sub
Dim oh As HTMLDocument
Private Sub Command1_Click()
Set x = New HTMLDocument
Set oh = x.createDocumentFromUrl("http://www.applevb.com/index.html", "null")
End SubPrivate Sub x_onreadystatechange()
If x.readyState = "complete" Then
Debug.Print "abcd"
If Not oh.body Is Nothing Then
Debug.Print oh.body.outerText
End If
End If
End Sub
OPEN "C:\AFILE" FOR OUTPUT AS #1
PRINT #1,TEXT
CLOSE #1