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: 4

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Watch MrExcel Video

Forum statistics

Threads
1,130,154
Messages
5,640,447
Members
417,143
Latest member
boukadidanizar

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
Top