Setting the value for CustomDocumentProperties

J

JHARRIS133

I am trying to create a version feature in Word VBA. I've got most of it to
work properly, but for some reason, I am unable to set this value. I have
created both a bookmark and a Word.Variable named "Version" to handle this
processing. I have correctly linked the source of the bookmark, Version, to
the variable. The bookmark source correctly updates, but the bookmark value
does not update correctly, and shows a broken link when I view it in the
File-->Properties window.

So everything is working properly, except for the updating of the Value of
the Version property. Below is the code that is crashing, specifically, the
line that reads, CustomDocumentProperties("Version").Value = lnkSrc. This
keeps saying that the Value method of DocumentProperty has failed. Value is
not a method, but a property in this instance, how can I fix this?

The following code is run when the user clicks on a button to update the
version number:
For Each prop In ThisDocument.CustomDocumentProperties
If prop.Name = "Version" Then
Dim lnkSrc
lnkSrc = ThisDocument.Variables(1).Value
CustomDocumentProperties("Version").LinkSource = lnkSrc
CustomDocumentProperties("Version").Value = lnkSrc
End If
Next
 
W

Word Heretic

G'day "JHARRIS133" <[email protected]>,

the way u have set it, the bookmark is the source. So instead, use a
DocProperty field to pull in the value.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


JHARRIS133 reckoned:
 
J

JHARRIS133

I finally got it to work properly. I was not capturing the bookmark text and
redisplaying it properly. Thanks.
 

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