none
vba URLDownloadToFile does not work on windows 10\office 2013 RRS feed

  • General discussion

  • Hi all,

    I am trying to download a csv web file of equity prices using a link working manually 

    https://query1.finance.yahoo.com/v7/finance/download/^GSPC?period1=946944000&period2=1499385600&interval=1d&events=history&crumb=15eDPcNY36Z

    When i try doing it by URLDownloadToFile , nothing is happening,i don't have a bug but the file is not downloaded 

    i am using the the following function

        Private Declare PtrSafe Function URLDownloadToFile _
                Lib "urlmon" Alias "URLDownloadToFileA" _
                (ByVal pCaller As LongPtr, _
                ByVal szURL As String, _
                ByVal szFileName As String, _
                ByVal dwReserved As LongPtr, _
                ByVal lpfnCB As LongPtr) As LongPtr

    my link = http://query1.finance.yahoo.com/v7/finance/download/^GSPC?period1=946944000&period2=1499385600&interval=1d&events=history&crumb=15eDPcNY36Z

    local file=localpath\myfile.csv

    it returns a code 2147942405

    Thank you in advance

    Friday, July 7, 2017 1:49 PM