Results 1 to 2 of 2

Thread: Help!! John Yingling, Bloodeye or other webbrowser document pros..

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195

    Help!! John Yingling, Bloodeye or other webbrowser document pros..

    how can i search all frames on a page to get the URL for a link named "Compose"?

    the only code i know of that will help answer this question is how to search a document for a link by its name

    Code:
        For i = 0 To WebBrowser1.Document.links.length - 1
            If WebBrowser1.Document.links(i).outertext = "Compose" Then
            msgbox WebBrowser1.Document.links(i).href
            End If
        Next i

  2. #2
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    Try this code. I didn't test it out. I took it from this thread, and altered it a little. It looks like it should work.
    http://www.vbforums.com/showthread.p...threadid=94149

    VB Code:
    1. Dim Doc As HTMLDocument
    2. Dim e As HTMLGenericElement
    3. Dim a As HTMLAnchorElement
    4.  
    5.  
    6. Private Sub Form_Load()
    7.     WebBrowser1.Navigate "http://www.hairdos.com/frameset.htm"
    8. End Sub
    9.  
    10. Private Sub Form_Unload(Cancel As Integer)
    11.     Set Doc = Nothing
    12. End Sub
    13.  
    14. Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, _
    15. URL As Variant, Flags As Variant, TargetFrameName As Variant, _
    16. PostData As Variant, Headers As Variant, Cancel As Boolean)
    17.     Set Doc = Nothing    
    18. End Sub
    19.  
    20. Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    21.     Dim i As Long
    22.     Set Doc = WebBrowser1.Document
    23.    
    24.     If (pDisp Is WebBrowser1.Object) Then
    25.         For i = 0 To Doc.frames.length - 1
    26.             For Each e In Doc.frames(i).Document.All
    27.                 If e.tagName = "A" Then
    28.                     Set a = e
    29.                     If a.outertext = "Compose" then
    30.                         MsgBox a.href
    31.                     End If
    32.                 End If
    33.             Next
    34.          Next
    35.     End If
    36. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width