I have been searching for a way to click a link with VBA. I can navigate to the page and do all the steps but, for the life of me can not find the answer to how to click this button. I can't use the href as it changes each month and I would like to make this as simple as possible. Maybe I am just attacking it all wrong? So I come here for your help.
Here is the information from the webpage that I am trying to have IE click for me.
Code:
Sub iepart1()Dim ie As Object
Dim pass As String
Dim user As String
Dim Obja As Object
user = InputBox("Enter your Username: ")
pass = InputBox("Enter your password: ")
Set ie = CreateObject("internetexplorer.application")
' Open Internet Explorer
With ie
.Visible = True
.Navigate "https://jonnystart.imakenews.com"
Do While .busy
DoEvents
Loop
' waits until IE is in a ready state
Do While .readystate <> 4
DoEvents
Loop
' Ready to move ahead with next command once .readystate<>4
' logs on to account name
' input what column to use for account name selection
ie.Document.All("accountName").Value = "acuraofseattle"
.Document.forms(0).submit
Do While .busy
DoEvents
Loop
' waits until IE is in a ready state
Do While .readystate <> 4
DoEvents
Loop
'Insert UserName and password
ie.Document.All("usermail").Value = user
ie.Document.All("PIN").Value = pass
.Document.forms(0).submit
Do While .busy
DoEvents
Loop
' waits until IE is in a ready state
Do While .readystate <> 4
DoEvents
Loop
Set Obja = ie.Document.getElementsByTagName("a")
If Link.innerHTML = "Post to the Web" Then
Link.Click
End If
End With
End Sub
Here is the information from the webpage that I am trying to have IE click for me.
HTML: