Article ID: 195425
Article Last Modified on 4/16/2007
' Launch Word
Dim wdapp As Object
Set wdapp = CreateObject("Word.Application")
' Make it visible...
wdapp.Visible = True
' Open a document...
Dim doc As Object<?xm-insertion_mark_start author="v-thomr" time="20070416T123039-0600"?>
<?xm-insertion_mark_end?> ' In Word 2007, change the document name to testdoc.docx.
Set doc = wdapp.Documents.Open("C:\mydocu~1\testdoc.doc")
' Add a custom document property...
doc.CustomDocumentProperties.Add "MyProp", False, 1, 123
' Uncomment this line to let Word know document is "dirty," so it
' will save the new Custom Document Property.
'doc.Saved = False
' Save document
doc.Save
' Close Word...
wdapp.Quit
Additional query words: WD2007
Keywords: kbexpertiseinter kbautomation kbprb KB195425