Results 1 to 4 of 4
  1. #1
    sylvaink is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    2

    browsing vba ie session follow link

    Hi,



    I need to load every day some text from different webpages from our client.

    I'm surfing with this code to a webpage and the code will click the desired link. I will come then on the 2nd page but I also need to click on this page on a link. How can I also click a link on the 2nd page that is loaded?

    Sub BrowseToSpecificUrl(Url As String, Target_Url As String)


    Dim IE As New SHDocVw.InternetExplorer
    Dim HTMLDoc As MSHTML.HTMLDocument
    Dim HTMLInput As MSHTML.IHTMLElement
    Dim HTMLAs As MSHTML.IHTMLElementCollection
    Dim HTMLA As MSHTML.IHTMLElement

    IE.Visible = True
    IE.navigate (Url)


    Do While IE.ReadyState <> READYSTATE_COMPLETE
    Loop

    Set HTMLDoc = IE.Document
    Set HTMLAs = HTMLDoc.getElementsByTagName("a")

    For Each HTMLA In HTMLAs
    If HTMLA.getAttribute("href") Like Target_Url Then
    HTMLA.Click
    Exit For
    End If
    Next HTMLA
    Do While IE.ReadyState <> READYSTATE_COMPLETE
    Loop
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Maybe instead of a physical 'click', use FollowHyperlink to open the URL.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    sylvaink is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    2
    I have try with FollowHyperlink, but then I have also a new session and I need to to login again, this I want to avoid. It's a very old site and user friendly.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    See if this helps, haven't done any testing: https://www.mrexcel.com/forum/excel-...ng-href-2.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. browsing too and for path to picture
    By dyhunter in forum Forms
    Replies: 1
    Last Post: 02-13-2018, 01:15 PM
  2. how to add access browsing button
    By Tousif Rahman in forum Access
    Replies: 1
    Last Post: 11-22-2017, 08:54 PM
  3. Browsing the contact details
    By sara-y in forum Forms
    Replies: 2
    Last Post: 03-25-2012, 08:43 PM
  4. Session variables
    By accessnewb in forum Programming
    Replies: 5
    Last Post: 08-04-2011, 11:45 PM
  5. Replies: 0
    Last Post: 11-28-2005, 01:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums