Please help solve why IE.Document.all("nd-fsc-icn nd-fsc-icn16 nd-fsc-icn-FullScreen-B").click does not work

0
Option Explicit
Sub ie_automated()
Dim IE As InternetExplorer
Dim sURL As String
sURL = "goldprice.org/silver-price.html"
Set IE = New InternetExplorer
With IE
.Top = 373
.Left = 25
.Width = 1700
.Height = 600
.AddressBar = 0
.Toolbar = 0
.Visible = False
.Navigate sURL
'Application.Wait Now + TimeSerial(0, 0, 10)
Do Until Not .Busy And .ReadyState = 4
DoEvents
Loop
On Error GoTo ErrHandler:
IE.Document.all("nd-fsc-icn nd-fsc-icn16 nd-fsc-icn-FullScreen-B")(0).Click
Application.Wait Now + TimeSerial(0, 0, 10)
End With
Do Until Not IE.Busy
DoEvents
Loop
Set IE = Nothing
Err.Clear
ErrHandler:
MsgBox Err.Number & "-" & Err.Description, vbCritical
End Sub
Post Edited
CODE Tags: You must add [CODE][/CODE] tags around your code! (click the CODE button to do this when creating a post)
Answer
Discuss

Answers

0

I can't find that class or id in the document. I think that the problem here will be that you are trying to import data that is loaded via javascript when the user views it in a browser and, from my research, there doesn't seem to be a good work-around for this.

You could try to find another source, say an xml file that is often updated and then download that file via a query into Excel.

Also, here is another version of the web query code that you might like: Import Web Data into Excel with VBA/Macros

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login