Hi:

I am a newbie in VBA. I have a list of bonds whose price I want to update everyday. So, I thought I should write a macro for it. I am using this site to get the latest price data: http://finra-markets.morningstar.com...&symbol=VMC.GP

I have the CUSIP number of the bonds and I want to use this as the search field. The website has assigned some internal ticker to each bond that shows up in the address bar, See the ticker and symbol in address above. So I cannot use a direct method to get the price data. However, the site also allows users to search for bonds by CUSIP number. When you go on the page, if you put the CUSIP number instead of "Lookup Symbol". You will get the result. For instance if you put "90131HAA3" in the field of Lookup you will get the correct result.

So, I have tried to write a code that opens the page and put the CUSIP code in the search field. However, I am unable to click the "GO" button. It is not working. I am getting no errors.

Please help.

    Private Sub IE_Autiomation()
    Dim i As Long
    Dim IE As Object
    Dim objElement As Object
    Dim objCollection As Object
 
    ' InternetExplorer Object
    Set IE = CreateObject("InternetExplorer.Application")
 
    IE.Visible = False
 
    IE.Navigate "http://finra-markets.morningstar.com/BondCenter/BondDetail.jsp?ticker=C424599&symbol=VMC.GP"
 
    ' Statusbar
    Application.StatusBar = "Loading. Please wait..."
 
    ' Wait while IE loading...
    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop
    
    Application.StatusBar = "Search form submission. Please wait..."
 
    Set objCollection = IE.document.getElementsByClassName("qs-ui-ipt autocomplete")
    objCollection(0).Value = "929160AF6"
 
    
    Set objCollection = IE.document.getElementsByClassName("button_blue autocomplete-go")
        
    objCollection(0).Focus
    objCollection(0).Click
    
    ' Wait while IE re-loading...
    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop
 
    ' Show IE
    IE.Visible = True
 
    ' Clean up
    Set IE = Nothing
    Set objElement = Nothing
    Set objCollection = Nothing
 
    Application.StatusBar = ""
End Sub