My code logs in to a site and navigates through a searies of pages to search for a part based on an excel input (. It then displays a results page but in order to view the desired part attributes you have to click on a link containing the original part number (in this case BPE7029002TEHG). I think the item I need to change is "prod" but it appears to be a hidden element and I get a runtime error when I attempt to access it. Another possibility is a duplicate link found on the page that contains the text "Loc Avail" but I seem to be unable to access this one also.
Code:
Sub LoginToEsales()
Dim SearchString As String
Dim ieApp As InternetExplorer
Dim ieDoc As Object
Dim ieTable As Object
Dim colLinks As Object
Set ieApp = New InternetExplorer
With ieApp
.Visible = True
.Navigate "http://es01-esales.cc-espend.net/scripts/cgiip.exe/WService=WSLIVE40/login.r"
While .Busy Or .ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set ieDoc = .Document
End With
With ieDoc.loginform
.operinit.Value = "gmbg"
.passWord.Value = "gmbg"
.submit
End With
With ieApp
While .Busy Or .ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With
With ieDoc.choosecust
.setcustno.Value = "240"
.submit
End With
With ieApp
While .Busy Or .ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set ieDoc = .Document.frames("main").Document
End With
ieDoc.forms("ByKeyword").Item("keywords").Value = "E7029002" 'My Excel input
With ieDoc.getElementsByName("submit")(0)
.Focus
.Click
End With
With ieApp
While .Busy Or .ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With
MsgBox (ieDoc.forms("addprod").Item("prod").Value) 'This is where I get the error
End Sub