Public Sub Extract_Data()
Dim httpReq As Object
Dim HTMLdoc As Object
Dim resultsTable As Object
Dim tRow As Object, tCell As Object
Dim destCell As Range
With ActiveSheet
.Cells.ClearContents
Set destCell = .Range("A1")
End With
Set httpReq = CreateObject("MSXML2.XMLHTTP")
With httpReq
.Open "GET", "Trade & Settlement Data on Corporate Bonds", False
.send
Set HTMLdoc = CreateObject("HTMLfile")
HTMLdoc.body.innerHTML = .responseText
End With
Set resultsTable = HTMLdoc.getElementById("ContentPlaceHolder1_GridViewrcdsFC")
For Each tRow In resultsTable.Rows
For Each tCell In tRow.Cells
destCell.Offset(tRow.RowIndex, tCell.cellIndex).Value = tCell.innerText
Next
Next
MsgBox "Done"
End Sub
Dim httpReq As Object
Dim HTMLdoc As Object
Dim resultsTable As Object
Dim tRow As Object, tCell As Object
Dim destCell As Range
With ActiveSheet
.Cells.ClearContents
Set destCell = .Range("A1")
End With
Set httpReq = CreateObject("MSXML2.XMLHTTP")
With httpReq
.Open "GET", "Trade & Settlement Data on Corporate Bonds", False
.send
Set HTMLdoc = CreateObject("HTMLfile")
HTMLdoc.body.innerHTML = .responseText
End With
Set resultsTable = HTMLdoc.getElementById("ContentPlaceHolder1_GridViewrcdsFC")
For Each tRow In resultsTable.Rows
For Each tCell In tRow.Cells
destCell.Offset(tRow.RowIndex, tCell.cellIndex).Value = tCell.innerText
Next
Next
MsgBox "Done"
End Sub