Hi,

Web scraping from the following site got error , while using the following code.

Need your help to resolve.

Sub DataBSE()

    Dim a(1 To 15), b(1 To 15, 1 To 3), E, i As Integer, c As Range

    With CreateObject("InternetExplorer.Application")

        .Navigate "http://www.bseindia.com/markets/currencyDerivatives/CurrDeriArchiveSum.aspx?expandable=4"
        .Visible = False

        While .busy Or .Readystate <> 4: DoEvents: Wend

        For Each E In .Document.getElementById("ctl00_ContentPlaceHolder1_ddlContracts").getElementsByTagName("div")
            If E.classname Like "mT10*" Then
                i = i + 1
                a(i) = E.Children(0).Children(0).getElementsByTagName("a")(0)
                b(i, 1) = E.Children(0).Children(0).innertext
                b(i, 2) = Trim$(Split(E.Children(0).Children(1).innertext, "|")(1))
                b(i, 3) = E.Children(0).Children(2).innertext
            End If
        Next

        With Sheets("USDINR").Cells(1).Resize(UBound(b, 1), UBound(b, 2))
            .Value = b
            For i = 1 To UBound(a, 1)
                .Parent.Add .Cells(i, 1), a(i), .Cells(i, 1).Value  
            Next
            .EntireColumn.AutoFit
        End With
    
        End With

    Dim Shell As Object
    Dim IE As Object
 
    Set Shell = CreateObject("Shell.Application")
 
    For Each IE In Shell.Windows
        If TypeName(IE.Document) = "HTMLDocument" Then
            IE.Quit
        End If
    Next

    
End Sub