jonathanwang003
Board Regular
- Joined
- May 9, 2014
- Messages
- 123
Hi All,
My macro below worked until today. I have a URL that used to open and paste right into excel. Not sure why this broke. Is there another method I could use to download the qurl into Excel? When I paste the qurl into IE, it opens up the CSV so it appears the qurl is still valid.
My macro below worked until today. I have a URL that used to open and paste right into excel. Not sure why this broke. Is there another method I could use to download the qurl into Excel? When I paste the qurl into IE, it opens up the CSV so it appears the qurl is still valid.
VBA Code:
Sub TestDownload()
Dim qurl as string
qurl = "https://query1.finance.yahoo.com/v7/finance/download/^GSPC?period1=1544400000&period2=1583366400&interval=1d&events=history&crumb=nfhoFBTOnvj"
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=Range("A1")
.PostText = True
.SaveData = True
.Refresh BackgroundQuery:=False
End With
End Sub