Error Extracting web infomation



  • The relevant website is here: http://www.etnet.com.hk/www/eng/stocks/ci_ipo_detail.php?code=08479&type=listing

    I want to extract the information "Joint Bookrunnersr" and "ChaoShang Securities, Kingsway Financial Services"

    I have the following code writes by myself :

        Sub Revisedrunner()
    
        Application.ScreenUpdating = False
        Application.Calculation = xlCalculationManual
    
        
        Dim cellv As Integer
        cellv = Cells(2, 7).Value
        
        Dim IE As Object
        Set IE = CreateObject("InternetExplorer.Application")
             
        IE.Visible = False
        IE.navigate "http://www.etnet.com.hk/www/tc/stocks/ci_ipo_detail.php?code=" & cellv & "&type=listing"
        
        Do While IE.Busy Or _
        IE.readyState <> 4
        DoEvents
        Loop
        
        Application.Wait (Now + TimeValue("0:00:03"))
            
        Dim Table As Object
        Dim TableTR As Object
        Dim TableTD As Object
        Dim Runnername As String
        Dim RunnerCat As String
        
        
        Set Table = IE.document.getElementsByClassName("ipoColumn")(1)
        For Each TableTR In Table
        RunnerCat = IE.document.getElementsByTagName("td")(0).innerText
        Runnername = IE.document.getElementsByTagName("td")(1).innerText
        Next TableTR
        
        
        Cells(2, 10) = RunnerCat
        Cells(3, 10) = Runnername
        
        IE.Quit
        Set IE = Nothing
    
       Application.ScreenUpdating = True
       Application.Calculation = xlCalculationAutomatic
    
      MsgBox ("Done!")
    
      End Sub
    

    An error of object doesn't support this property or method.
    Does anyone know the reason?? Wht should I do?
    Thanks!


  • administrators

    Hi @kenlihoyin This code should work :

    Sub Revisedrunner()
    
        Application.ScreenUpdating = False
        Application.Calculation = xlCalculationManual
    
        
        Dim cellv As Integer
        cellv = Cells(2, 7).Value
        
        Dim IE As Object
        Set IE = CreateObject("InternetExplorer.Application")
             
        IE.Visible = True
        IE.navigate "http://www.etnet.com.hk/www/eng/stocks/ci_ipo_detail.php?code=08479&type=listing"
        
        Do While IE.Busy Or _
        IE.readyState <> 4
        DoEvents
        Loop
        Dim rowElements As Object, rowElement As Object, columnElement As Object
        Set rowElements = IE.document.getElementsByClassName("figureTable")(1).getElementsByTagName("tr")
        i = 3
        For Each rowElement In rowElements
            j = 1
            For Each columnElement In rowElement.getElementsByTagName("td")
                Debug.Print columnElement.innerText
                Cells(i, j).Value = columnElement.innerText
                j = j + 1
            Next
            i = i + 1
        Next
        IE.Quit
        Set IE = Nothing
    
       Application.ScreenUpdating = True
       Application.Calculation = xlCalculationAutomatic
    
      MsgBox ("Done!")
    
      End Sub
    

Log in to reply
 

Looks like your connection to Codingislove Forum was lost, please wait while we try to reconnect.