Results 1 to 13 of 13

Thread: Click a link on IE browers

Hybrid View

  1. #1
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    OK, this should do it. I've added a check for the page title because otherwise you wouldn't be able to have any other IE windows opened.
    VB Code:
    1. Dim objWindows As Object, objIE As Object, i As Integer
    2.  
    3. Set objWindows = CreateObject("Shell.Application").windows
    4.  
    5. If objWindows.Count > 0 Then 'Make sure there are windows
    6.     For Each objIE In objWindows
    7.         If InStr(1, objIE.FullName, "IEXPLORE.EXE", vbTextCompare) <> 0 Then 'IE instead of Windows Explorer
    8.             If InStr(1, LCase(objIE.Document.Title), "website.com") <> 0 Then 'Checking if the title contains "website.com"
    9.                 For i = 0 To objIE.Document.links.length - 1 'Loop through the links collection
    10.                     If objIE.Document.links.Item(i).innerText = "Click here" Then 'If the link text is the one we're looking for
    11.                         objIE.Navigate objIE.Document.links.Item(i) 'Navigate to the page
    12.                     End If
    13.                 Next i
    14.             End If
    15.         End If
    16.     Next
    17. End If
    18.  
    19. Set objWindows = Nothing
    20. Set objIE = Nothing
    Last edited by TheVader; May 26th, 2004 at 10:15 AM.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

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