Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA to create and update document tags?

Status
Not open for further replies.

mrmovie

Technical User
Oct 2, 2002
3,094
GB
Am looking for examples of how to set / create / update document tags? Probably start off with word documents, need to handle .doc and .docx if there are any differences in tagging implementation i dont know.
have found things talking about ActiveWorkbook.ContentTypeProperties("Line of Business").Value = pLine, but the posts seem specific to Sharepoint?
any pointers would be welcome, sorry if this has been asked before

I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
Can you "set / create / update document tags" 'by-hand' in Word in .doc and .docx?
If so, what do you get if you record a Macro with your steps?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Hi Andy, havent tried that, only because i read another post staying that they had tried that but nothing was recorded.
Thanks for the post though. I will take a look at it tomorrow :)

I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
..hmm, no, nothing gets recorded when you record a macro and go to File\Info\Properties\Tags

I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
Hi All,
So, using the File/Info/Properties/Tags results in data being put into MsgBox ActiveDocument.BuiltInDocumentProperties("Keywords")
One can make us of CustomDocumentProperties as well (from MS Help)

Set myRange = ActiveDocument.Content
myRange.Collapse Direction:=wdCollapseEnd
For Each prop In ActiveDocument.CustomDocumentProperties
With myRange
.InsertParagraphAfter
.InsertAfter prop.Name & "= "
.InsertAfter prop.Value
End With
Next
...and adding a new one
thename = InputBox("Please type your name", "Name")
ActiveDocument.CustomDocumentProperties.Add _
Name:="YourName", LinkToContent:=False, Value:=thename, _
Type:=msoPropertyTypeString

btw, when you use the CustomDocumentProperties you end up with a custom.xml file (if you expand the .docx using unzip or something)...serverside process to pull out these properties and act on them?

Anyway, i think the above covers my original question...except how does one update / create a new CustomDocumentProperty via the normal WORD GUI?


I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
In Word 2013 .. File > Info, Properties dropdown > Advanced properties > Custom tab

.. or ..

Developer tab > Document Panel, check "Always show Information Panel" checkbox > OK, then Document Properties dropdown > Advanced properties > Custom tab

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top