captainxcel
New Member
- Joined
- Jul 28, 2017
- Messages
- 35
- Office Version
- 2016
- Platform
- Windows
Thanks in advance to anyone who can help ...
For a couple of years I've had a working macro to pull historical stock data from Yahoo finance into a sheet in Excel starting at cell A1. Recently it stopped working! Though the if pasted into a browser will deli...&interval=1d&events=history&crumb=k3gEejzEY5Q
Public Sub Load_Yahoo()
Dim symbol As Variant, Qurl As Variant, startDate As Date, endDate As Date, interval As String, crumb As String
On Error Resume Next
symbol = [ticker]
startDate = [Start_Date]
endDate = [End_Date]
' endDate = CDate(Format(Date, "yyyy-mm-dd")) ' or endDate == today
interval = Trim([your_interval])
crumb = Trim([your_crumb])
Qurl = "https://query1.finance.yahoo.com/v7/finance/download/" & symbol _
& "?period1=" & (startDate - DateSerial(1970, 1, 1)) * 86400 _
& "&period2=" & (endDate - DateSerial(1970, 1, 1)) * 86400 _
& "&interval=" & interval & "&events=history&crumb=" & crumb
= Qurl With Sheets("Historical...uery:=False End With End Sub
For a couple of years I've had a working macro to pull historical stock data from Yahoo finance into a sheet in Excel starting at cell A1. Recently it stopped working! Though the if pasted into a browser will deli...&interval=1d&events=history&crumb=k3gEejzEY5Q
Public Sub Load_Yahoo()
Dim symbol As Variant, Qurl As Variant, startDate As Date, endDate As Date, interval As String, crumb As String
On Error Resume Next
symbol = [ticker]
startDate = [Start_Date]
endDate = [End_Date]
' endDate = CDate(Format(Date, "yyyy-mm-dd")) ' or endDate == today
interval = Trim([your_interval])
crumb = Trim([your_crumb])
Qurl = "https://query1.finance.yahoo.com/v7/finance/download/" & symbol _
& "?period1=" & (startDate - DateSerial(1970, 1, 1)) * 86400 _
& "&period2=" & (endDate - DateSerial(1970, 1, 1)) * 86400 _
& "&interval=" & interval & "&events=history&crumb=" & crumb
= Qurl With Sheets("Historical...uery:=False End With End Sub