Thread: [Solved] Automate document properties
View Single Post
 
Old 07-31-2014, 03:30 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,382
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub SetProperties()
'
' Set key document properties
'
Dim Rng As Range
With ActiveDocument
    .BuiltInDocumentProperties("category") = "Generic Template"
    Set Rng = .Tables(1).Cell(2, 2).Range
    Rng.End = Rng.End - 1
    .BuiltInDocumentProperties("title") = Rng.Text
    Set Rng = .Tables(1).Cell(4, 2).Range
    Rng.End = Rng.End - 1
    .BuiltInDocumentProperties("subject") = Rng.Text
    Set Rng = .Tables(1).Cell(9, 2).Range
    Rng.End = Rng.End - 1
    .BuiltInDocumentProperties("author") = Rng.Text
    Set Rng = .Tables(1).Cell(10, 2).Range
    Rng.End = Rng.End - 1
    .BuiltInDocumentProperties("manager") = Rng.Text
    .Save
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote