Internet Explorer对象有个成员是Document对象,不知道Document对象都有什么方法和属性?我想知道怎样使用它来得到网页中的特定内容(文字、控件、URL链接等)。

解决方案 »

  1.   


      需要引用Microsoft Internet Controls 文件
    Private Sub GetBody()
    Dim dWinFolder As New ShellWindows                         'IE窗口
    Dim objIE As Object
    Dim objDoc As Object
    Dim i As Integer
       For Each objIE In dWinFolder
              If objIE.LocationURL = "http://community.csdn.net/Expert/topic/4532/4532175.xml?temp=.6563379" Then
                    Set objDoc = objIE.Document
                    For i = 1 To objDoc.All.Length - 1
                        If objDoc.All(i).tagname = "BODY" Then
                          Text1(0).Text = objDoc.All(i).innerText
                        End If
                    Next
                   
                Exit For
            End If
    Next
    End Sub
    text里面的内容就是你需要的网页内容