从Sharepoint打开+编辑Excel文件

时间:2017-08-09 19:19:58

标签: excel-vba vba excel

我正在尝试通过VBA从具有相同名称的sharepoint库中打开一个excel文件。这是变量

定义变量:

Private Master_File As String
Private Master_FileLocation As String
Private Master_Open As Workbook

Assign_Variables:

Master_File = "Master Data.xlsx"
Master_FileLocation = "http://sharepoint/page"


Sub Open_Master()

    Application.ScreenUpdating = False
    Application.AskToUpdateLinks = False
    Application.DisplayAlerts = False

    On Error Resume Next
    Set Master_Open = Workbooks.Open(Master_File)

    If Master_Open Is Nothing Then

         Workbooks.Open FileName:=Master_FileLocation & "/" & Master_File, ReadOnly:=False

    End If

  End Sub

代码运行时没有错误,但没有打开excel文件。当我单击该文件并直接从我的Internet Explorer浏览器复制“快捷方式”时,会出现以下内容:

   http://sharepoint/org/%20Master%20Data/%20Master%20Data.xlsx

当我复制此路径并将其粘贴到文件夹搜索栏时,我可以打开该文件夹。因此,我知道文件+文件夹存在。我也理解一些函数,如ChDir和GetOpenFileName不适用于HTTP。也就是说,我的功能非常简单,不需要这些功能。任何帮助将不胜感激。

0 个答案:

没有答案
相关问题