+ Reply to Thread
Results 1 to 6 of 6

Macro to click on a dynamically generated hyperlink

  1. #1
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    3

    Macro to click on a dynamically generated hyperlink

    Hi all... total newbie to this here with only the knowledge that google and working backwards on existing macros has given me....

    So i'm trying to write an excel macro that will navigate to a webpage, enter some details from a worksheet, save them and then click on a dynamically generated hyperlink that is produced from the entered information. This link changes dependant on what information is entered.

    I can navigate to the page, enter the details, save but i'm unable to get the macro to click on the link generated due to it always being different. I've tried a number of solutions I have come across, but nothing seems to work.

    The relevant parts of the code are as follows:

    Please Login or Register  to view this content.

    Any ideas?
    Last edited by Fotis1991; 04-13-2017 at 05:32 AM. Reason: code tags added!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Macro to click on a dynamically generated hyperlink

    Is there anything in the URL of the link you could use to identify it?

    If there is you could get the collection of all the links on the page using appIE.document.links, loop through it, identify the link you want and then click it.

    PS Can you please add code tags when posting code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to click on a dynamically generated hyperlink

    Sorry about the not using code tags...

    The URL of the link is as below, with the numbers at the end of the link being dynamic and changing dependant on what is input. Going on what you are saying, would using appIE.document.links then be able to identify it when the numbers at the end are different each time depending on input data?

    HTML Code: 

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Macro to click on a dynamically generated hyperlink

    Is there anything in the link that could be used to distinguish it from the other links on the page?

    For example is the 'mUserProfile.aspx' part of the link unique to the link?

    If it was you could use something like this.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-11-2017
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to click on a dynamically generated hyperlink

    It looks as if that link is unique on the page so what was suggested should/could work but I cant get it to... Im not sure where it should be placed for it to do so...

    The total code that I have done is as follows. It works up until the line where it says, and the section after it works in isolation but its just the clicking of the link which sits under the text View to get from one bit to another where it falls. Any ideas?

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-17-2011
    Location
    romania
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Macro to click on a dynamically generated hyperlink

    I have a problem somehow on the same lines, that is that i want to click a link that is dynamic , there are multiple href links with the same class name. What i do know is it's position , eg sometimes i would like to access the second link presented and sometimes the first or the third. Can someone point me in the right direction?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dynamically generated Shell command
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2016, 02:31 PM
  2. Replies: 0
    Last Post: 06-22-2014, 04:18 PM
  3. How to Create Dynamically Generated Word List
    By GoodManRob in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-28-2014, 11:24 AM
  4. Dynamically Generated Form And Their Click Events
    By fenilbhoot in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-12-2013, 10:13 AM
  5. [SOLVED] Use VBA to download a dynamically generated image from the web.
    By nponoBegHuk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2012, 09:51 AM
  6. Setting up a dynamically generated range reference
    By cveetan in forum Excel General
    Replies: 8
    Last Post: 02-22-2012, 07:37 AM
  7. Dynamically Generated Range using Macro
    By JM.EE01@gmail.com in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-15-2006, 03:15 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1