Datanalysis
New Member
- Joined
- Feb 9, 2015
- Messages
- 1
I am trying to pull the interest rates from the first table of the following page:
Bank Accounts | BMO Bank of Montreal
However, my code bellow isn't extracting the "0.80%" value and is only extracting "%". I think the values automatically update through javascript. Is there any way to extract this number through VBA?
Bank Accounts | BMO Bank of Montreal
However, my code bellow isn't extracting the "0.80%" value and is only extracting "%". I think the values automatically update through javascript. Is there any way to extract this number through VBA?
Code:
Sub BMO()
Dim Ptrtbl As Long, r As Long, c As Long
Dim htm As Object
Dim elemCollection, ratenum As Object
Set htm = CreateObject("htmlFile")
With CreateObject("msxml2.xmlhttp")
.Open "GET", "http://www.bmo.com/home/personal/banking/rates/bank-accounts?pChannelId=0", False
.Send
htm.body.innerHTML = .responseText
End With
Set elemCollection = htm.getelementsbytagname("table")
For Each itm In elemCollection
If itm.Summary = "This table shows interest rates based on a paid balance for a smart saver account." Then
Set ratenum = htm.getelementsbytagname("td")
For Each num In ratenum
If num.classname = "rateCel" Then
'MsgBox (num.outerHTML)
ActiveCell = num.innerText
If ActiveCell.Column = 2 Then
ActiveCell.Offset(1, -1).Select
Else
ActiveCell.Offset(0, 1).Select
End If
End If
Next
End If
Next
End Sub