How to download a file from Sharepoint with VBA

前端 未结 1 1628
小蘑菇
小蘑菇 2020-12-21 19:54

I am trying to download a file from Sharepoint with VBA and can not figure out how to do it! The file is actually a picture (not sure if that matters?) and the download goe

相关标签:
1条回答
  • 2020-12-21 20:40

    Here is the wrapper code I currently use to download files from our Sharepoint site:

    Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
        ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
    
    Function DownloadFileFromWeb(strURL As String, strSavePath As String) As Long
        ' strSavePath includes filename
        DownloadFileFromWeb = URLDownloadToFile(0, strURL, strSavePath, 0, 0)
    End Function
    

    The function DownloadFileFromWeb returns 0 if the download was successful.

    0 讨论(0)
提交回复
热议问题