Results 1 to 6 of 6

Macro to click on a dynamically generated hyperlink

Threaded View

  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:

    Sub createNewUser()
    Dim email As String, password As String
    Dim appIE As InternetExplorer
    Dim rowNum As Long
    Set appIE = New InternetExplorer
    
    email = "emailaddressremovedforsecurity"
    password = "passwordremovedforsecurity"
    
    With appIE
        .navigate "Loginpage"
        .Visible = True
        
        Do While appIE.Busy
            Application.Wait DateAdd("s", 1, Now)
        Loop
        
        .document.getElementById("textboxUsername").Value = email
        .document.getElementById("textboxPassword").Select
        .document.getElementById("textboxPassword").Value = password
        .document.getElementById("buttonLogin").Click
        
        Do While appIE.Busy
            Application.Wait DateAdd("s", 1, Now)
        Loop
    
        .navigate "Securepage"
        
        Do While appIE.Busy
            Application.Wait DateAdd("s", 1, Now)
        Loop
    
        .navigate "Userdetailspage"
        	
        Do While appIE.Busy
            Application.Wait DateAdd("s", 1, Now)
        Loop
            
        rowNum = 2
        Do While Sheets("Combined").Cells(rowNum, 1).Value <> ""
        
        .document.getElementById("rbtnTypeBoth").Click
        .document.getElementById("tbEmail").Value = Sheets("Combined").Cells(rowNum, 1).Value
        .document.getElementById("ContentPlaceHolder1_rblFilterRights_0").Click
        .document.getElementById("ContentPlaceHolder1_btnFilter").Click
          
        Do While appIE.Busy
            Application.Wait DateAdd("s", 1, Now)
        Loop
                
        .document.getElementById("ctl00_ContentPlaceHolder1_gridResults_ctl00__0").Click
    
    This is where it appears to go wrong, the link on the page appears as:
    
    <tr class="rgRow" id="ctl00_ContentPlaceHolder1_gridResults_ctl00__0" style="white-space:nowrap;">
    		<td style="font-weight:bold;"><a href="https://www.excelforum.com/User/mUserProfile.aspx?id=247382">View</a>

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

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