繁体   English   中英

如何使用VBA在SharePoint中获取Excel文件的属性?

[英]How to obtain the properties of an Excel file in SharePoint using VBA?

我正在创建带有命令按钮的宏文件,当您单击该宏文件时,它将显示属性,尤其是SharePoint网站上载的Excel文件的上次修改日期和时间。 我如何使用VBA做到这一点。 您及时的回复非常感谢。 非常感谢!

我相信让vba /宏运行的唯一方法是从SharePoint 2010中“在Excel中打开”。我认为当您在浏览器中打开Excel文件时,vba / macros不会运行。

我向VBA添加了以下代码(按alt F11键可以打开VBA编辑器):

 Public Sub documentProperties()
      On Error Resume Next
      Dim oApp As New Excel.Application
      Dim oWB As Workbook
      Set oWB = ActiveWorkbook

      Dim propertieslist As String
      For l = 1 To oWB.BuiltinDocumentProperties.Count
        MsgBox oWB.BuiltinDocumentProperties.Item(l).Name & ":" & oWB.BuiltinDocumentProperties.Item(l).Value
      Next l

      MsgBox propertieslist
    End Sub

然后,我在excel工作表上放置一个按钮(Google搜索“ excel 2010添加按钮”)以获取有关将开发人员菜单添加到功能区的说明。

暂无
暂无

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

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