Set Sharepoint Tags/Properies with VBA

12,784

As far as I know , we can set the Tags of an Excel document in VBA before it gets uploaded onto a Sharepoint library, by settings values for the

Workbook.ContentTypeProperties

For example:

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

I'd link some readings to learn more: It might be useful:[John Chapman's SharePoint Blog: Update SharePoint Document Property from Excel VBA]

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

Please note that there are some troubles with certain types of property: see Setting Custom Document properties that will be used in Sharepoint and this thread

Share:
12,784

Related videos on Youtube

Niall
Author by

Niall

Updated on September 15, 2022

Comments

  • Niall
    Niall over 1 year

    Is it possible to set the Tags of a Sharepoint document (specifically Excel) using VBA. At present the only way I know to handle this is to save a file to Sharepoint, set the Tags when prompted, nd then download this file again and use it as a template.

    However, I need to work with several different permuations of these Tags and it's a major pain having to create a separate template for each one, especially if you then need to amend the template, and have to replicate those amendments 10s of times.

    So is it possible to do this via VBA? I've tried recording a macro whilst I set them and it doesn't record anything regarding the Tags

    • Ben_Coding
      Ben_Coding about 10 years
      What Version of SharePoint are you using?
  • Niall
    Niall about 10 years
    Thanks for your help. I can confirm that I am able to set the Sharepoint tags using this method, however the document needs to have been saved to Sharepoint first in order to know what the tags are. This does help a lot, though it would be good to be able to set the Tags in advance of the upload to Sharepoint if possible, so I'm going to leave the bounty open for a few more days in case anyone does know a method of doing this, although it doesn't seem that there is a way