Hi all,
I got a problem when navigate IE via vba. Below is my code, problem exists in the red words. After I input ticker and click "search" button, the IE jumps to another page, but when I wanna further click a link on the new page, the vba still "remembers" the old URL. How can I amend the code to let me have a chance to select links on the new page? Thank you so much.
Option Explicit
Sub IEnagviate()
Dim ie As Object
Dim form As Variant, button As Variant, ele As Object
Dim Ticker As String
Set ie = CreateObject("InternetExplorer.Application")
Ticker = 5
With ie
.Visible = True
.navigate ("http://sdinotice.hkex.com.hk/di/NSSrchCorp.aspx?src=MAIN&in=1&lang=EN&")
While ie.ReadyState <> 4
DoEvents
Wend
ie.document.GetElementsByName("txtStockCode").Item.innertext = Ticker
Set button = ie.document.GetElementsByName("cmdSearch")(0)
button.Click
End With
For Each ele In ie.document.getElementsByTagName("a")
If InStr(ele.innerhtml, "List of all notices") > 0 Then ele.Click: Exit For
Next
Set ie = Nothing
End Sub
Bookmarks