Trouble navigating href using vba

hzrvkt

New Member
Joined
Jul 10, 2004
Messages
33
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
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,213,486
Messages
6,113,932
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top