Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change customdocumentproprties in Word from Access

Status
Not open for further replies.

ycim

Programmer
Feb 9, 2005
95
CA
I am currently working on a document mgmt program. The basic functionality is Access has a database of the document names and the directories, and then opens word to do the actual editing (through hyperlinks).

Everytime a user clicks on a hyperlink, I want to go into the word document and change the property (in customdocumentproperties) called REFERENCE with data from the access table.

I cannot figure out how to set/change a custom property in word. Can anyone give me a code snippet that will work to set this up?

Thanks much!
 
You simply change the Value.
Code:
ActiveDocument.CustomDocumentProperties("Reference").Value = "Harry Houdini"

ActiveDocument could also be change to a specific document:
Code:
Documents("BlahWhatever.doc").CustomDocumentProperties("Reference").Value = "Harry Houdini"

This is assuming that Reference already exists as a custom property - which is the situation I gather.

The Value is a (assuming that Reference was set up as Type msoPropertyTypeString - constant = 4) string, so any string variable is acceptable as well.
Code:
Dim strNewValue As String
[COLOR=red]' set variable from Access?[/color red]
strNewValue = [i]whatever[/i]
ActiveDocument.CustomDocumentProperties("Reference").Value = strNewValue

Gerry
My paintings and sculpture
 
OH MY! I can't beleive that was so simple! I was looking for some type of property to set!

Thanks so much!
 
OK..your warning is well heeded! I ran across a document that needs to have the reference added in. Do you have a quick one that will point me in the right direction before I spend hours looking for the "how to do that"?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top