Auto Update DOCPROPERTY

C

Colin Steadman

If I change a DOCPROPERTY value, what is the fastest way to update all
DOCPROPERTY fields in the document? I am using Edit | Select All and
F9 to update the DOCPROPERTY values.

Is there a better/faster way?

TIA,

Colin
 
G

Greg

Collin,

I use a pair of macros in my document template. Here is
an example. All you really need is the last
line "ActiveDocument.Fields.Update":

Sub AutoNew()
Dim EmpName As String
Dim BadgeNum As String
EmpName = InputBox("Enter employee
name", "Employee Name", "John Q. Sample")
BadgeNum = InputBox("Enter badge number", "Badge
Number", "0000")
ActiveDocument.CustomDocumentProperties("Employee
Name").Value = EmpName
ActiveDocument.CustomDocumentProperties("Badge
Number").Value = BadgeNum
ActiveDocument.Fields.Update
End Sub

Sub AutoOpen()

Dim Update As VbMsgBoxResult
Dim PolicyNum As String
Dim ClientName As String
On Error GoTo ExitSub
Update = MsgBox("Update Document Information?", vbYesNo)
If Update = vbYes Then
EmpName = InputBox("Enter employee name", "Employee
Name", "John Q. Sample")
BadgeNum = InputBox("Enter badge number", "Badge
Number", "0000")
ActiveDocument.CustomDocumentProperties("Employee
Name").Value = EmpName
ActiveDocument.CustomDocumentProperties("Badge
Number").Value = BadgeNum
ActiveDocument.Fields.Update
End If
ExitSub:
End Sub
 

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