首页 文章

使用VBA设置Sharepoint标签/功能

提问于
浏览
4

是否可以使用VBA设置Sharepoint文档的标签(特别是Excel) . 目前,我知道处理此问题的唯一方法是将文件保存到Sharepoint,在提示时设置标签,然后再次下载此文件并将其用作模板 .

但是,我需要处理这些标签的几个不同的修复,并且为每个标签创建一个单独的模板是一个主要的痛苦,特别是如果您需要修改模板,并且必须复制这些修改10次 .

那么通过VBA可以做到这一点吗?我在设置它时尝试录制宏,但它没有记录有关标签的任何内容

2 回答

  • 6

    据我所知,我们可以在 VBA 之前将 Excel document 的标签设置为上传到Sharepoint库之前,通过设置值

    Workbook.ContentTypeProperties
    

    例如:

    ActiveWorkbook.ContentTypeProperties("Line of Business").Value = pLine
     ActiveWorkbook.ContentTypeProperties("Company Name").Value = pCompany
     ActiveWorkbook.ContentTypeProperties("Year").Value = pYear
    

    我将链接一些阅读材料以了解更多信息:它可能很有用:[John Chapman的SharePoint博客:从Excel VBA更新SharePoint文档属性]

    http://www.sharepointjohn.com/sharepoint-2007- --update-sharepoint-document-property-from-excel-vba /

    请注意,某些类型的 property 存在一些问题:请参阅Setting Custom Document properties that will be used in Sharepointthis thread

  • 0

    我有同样的问题 . 我使用的解决方法如下

    On Error Resume Next
    Application.DisplayAlerts = False
    ThisWorkbook.SaveAs Pth
    ThisWorkbook.ContentTypeProperties("Report Type").Value = "BranchManagement"
    ThisWorkbook.SaveAs Pth
    Workbooks(ThisWorkbook.Name).CheckIn
    Application.DisplayAlerts = True
    On Error GoTo 0
    

    在我的情况下,我还必须在保存后检查书 . 希望这可以帮助!

相关问题