Fetch stock quote issue

DedesF

New Member
Joined
Dec 11, 2020
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi all,
I am having a real headache trying to pull in a stock quote from SANTIAGOX with VBA (The price is the attached image).
This is what I get so far on my macro:

VBA Code:
Sub Precios()

Dim request As Object
Dim response As String
Dim html As New HTMLDocument
Dim website As String
Dim price As Variant

website = "https://www.bolsadesantiago.com/resumen_instrumento/AESGENER"
Set request = CreateObject("MSXML2.XMLHTTP")

request.Open "GET", website, False
request.setRequestHeader "If-Modified-Since", "Sat, 1 dic 2020 00:00:00 GMT"
request.send

response = StrConv(request.responseBody, vbUnicode)

html.body.innerHTML = response
precio = html.getElementsByClassName("text-muted ng-binding")(1).innerText
MsgBox precio

End Sub

Can anyone help me telling me what I am missing or doing wrong?
Thanks in advance
 

Attachments

  • 1.png
    1.png
    63.8 KB · Views: 12

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,214,830
Messages
6,121,835
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top