Code to Change Doc Properties with Variables

Joined
Jun 9, 2014
Messages
9
Reaction score
0
I have this code that I'm trying to create where it automatically sets three of the document properties. I would like the Subject to be the current date in MMMM YYYY format, the Author to be "eClinicalWorks/" and the Title to take from the Style Title that I use only for the title of the document. Is this even possible?

This is the code I've been working with:

Sub Properties()
'
' Properties Macro
'
'
Option Explicit

Sub Set_Properties()

With ActiveDocument
.BuiltInDocumentProperties("Subject") = Selection.InsertDateTime
.BuiltInDocumentProperties("Author") = "eClinicalWorks/"
.BuiltInDocumentProperties("Title") = Selection.Fields.Add = "STYLEREF Title"​
End With

End Sub

I know I'm missing something big here... any help would be really appreciated :)

- Kate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top