简体   繁体   English

从 Sharepoint 下载 Excel 文件,保存到桌面

[英]Download Excel file from Sharepoint, Save to Desktop

I am trying to download an excel file stored in sharepoint (no unc path available) to my desktop.我正在尝试将存储在 sharepoint 中的 excel 文件(没有可用的 unc 路径)下载到我的桌​​面。

This code below seems to work and create "CST.xlsx" but I get an error msg:下面的代码似乎可以工作并创建“CST.xlsx”,但我收到一条错误消息:

在此处输入图像描述

Notes: Url for excel file is taken directly from the web address bar and everthing after ".xlsx" is removed.注意: excel文件的Url直接取自网址栏,“.xlsx”后的所有内容都被删除。

Code:代码:

    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
    
    Sub download()
    
    Call DownloadFileFromWeb("url.xlsx", "Desktop\download\CST.xlsx")
    
    End Sub

请参阅我在此线程中关于相同问题的回答以获取解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM