Hello Geniuses,
I've been lurking on this forum for many moons trying to learn how to be vba useful but today I'm vba useless. Please help me because I really don't want to do this manually. I hope I can describe this correctly. I have a spread sheet with ID numbers in column A. I have a code that opens an internal website, logs me in, searches the ID and clicks the search button. This brings up the identifying information for that ID. At the bottom of that page is a link labeled "View/Update". This link has no "id" and I cant figure out how to make my code click it. I'm baffled. I obviously have a ton more to do after getting that to work but I'm trying to take this one step at a time.
Sub LOGIN()
Dim ie As InternetExplorer
Dim i As Variant
Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate2 "My Website"
Do While ie.Busy: DoEvents: Loop
Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
ie.Document.all("TextBox_UserName").Value = "Username"
ie.Document.all("TextBox_LoginPassword").Value = "Password"
ie.Document.all("Button_Login").Click
Do While ie.Busy: DoEvents: Loop
Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
ie.Navigate2 "http://mi-inet01.mimc.com/apps/PM/EquipmentManagement/equipment/Master.aspx"
Do While ie.Busy: DoEvents: Loop
Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
ie.Document.all("txtNumber").Value = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
ie.Document.all("butQuickSearch").Click
Dim ele As Object
For Each ele In ie.Document.getElementsByTagName("href")
If ele.Value = "View/Update" Then ele.Click: Exit For
Next
End Sub
Clearly I don't know what I'm doing.
This is the relevant Element info.
I've been lurking on this forum for many moons trying to learn how to be vba useful but today I'm vba useless. Please help me because I really don't want to do this manually. I hope I can describe this correctly. I have a spread sheet with ID numbers in column A. I have a code that opens an internal website, logs me in, searches the ID and clicks the search button. This brings up the identifying information for that ID. At the bottom of that page is a link labeled "View/Update". This link has no "id" and I cant figure out how to make my code click it. I'm baffled. I obviously have a ton more to do after getting that to work but I'm trying to take this one step at a time.
Sub LOGIN()
Dim ie As InternetExplorer
Dim i As Variant
Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate2 "My Website"
Do While ie.Busy: DoEvents: Loop
Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
ie.Document.all("TextBox_UserName").Value = "Username"
ie.Document.all("TextBox_LoginPassword").Value = "Password"
ie.Document.all("Button_Login").Click
Do While ie.Busy: DoEvents: Loop
Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
ie.Navigate2 "http://mi-inet01.mimc.com/apps/PM/EquipmentManagement/equipment/Master.aspx"
Do While ie.Busy: DoEvents: Loop
Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
ie.Document.all("txtNumber").Value = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
ie.Document.all("butQuickSearch").Click
Dim ele As Object
For Each ele In ie.Document.getElementsByTagName("href")
If ele.Value = "View/Update" Then ele.Click: Exit For
Next
End Sub
Clearly I don't know what I'm doing.
This is the relevant Element info.