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?
Bookmarks