Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88054

Scrape Exchange Rate from Website with Excel VBA

$
0
0

I am trying to scrape the exchange rate of the COP to the USD into Cell A1 of Sheet 1 in my Workbook. I need to pull rate from the following website:

https://www.banrep.gov.co/

When I inspect the element on the website I get the following: div class="up-big"> a href="/estadisticas/trm" target="_blank" style="color:#FFF;">3.452,67

I have tried to reference the class "up-big" but believe I am running into issues because the class is nested.

I have been troubleshooting the following code:

Public Sub GetInfo()
  Dim Loc As Range
   Dim TxtRng As Range
    Dim element As Variant
    Dim elements As Object
  Dim V As Variant
 Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")
With appIE
    .navigate "https://www.banrep.gov.co"
    .Visible = True
End With

Do While appIE.Busy
    DoEvents
Loop
Set TxtRng = Sheets("Sheet1").Range("A1")
Set elements = appIE.document.Tables("ViewTable ResultsTable GreenBar").elements("up-big")
 For Each element In elements
TxtRng = element.innerText
Next element
appIE.Quit
Set appIE = Nothing
 ' Set elements = HTMLDoc.getElementsById("up-big")
End Sub

I am hoping someone can point me in the right direction. Thank you.


Viewing all articles
Browse latest Browse all 88054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>