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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have text from textbox automatically insert into Document Properties

Status
Not open for further replies.

be17

Technical User
Feb 7, 2001
26
US
Is there a way to automatically have information that the user types in a textbox of a userform get saved as a field in the document properties of Word (ie. title, subject, author, etc.)?

My userforms are set up so that the text in the textbox gets inserted in a bookmark within the document. In addition, I also want it to show up in the "title" property when the user goes to File, Properties and looks in the Summary tab. This will help us with any future searches that need to be done on this document.

I am working in Word97. Any suggestions would be appreciated. Thanks.

Bronwyn
 
here's a quick excerpt that may be of help? - as you can see the code checks if the custom property (ASPlocation) is set, if not then is assigns the filename (-.doc and +.asp) - otherwise it

Code:
If thisDoc.CustomDocumentProperties("ASPlocation").Value = "" Or thisDoc.CustomDocumentProperties("ASPlocation").Value = " " Then
  Open thisDoc.Path + "\" + Left(thisDoc.Name, Len(thisDoc.Name) - 4) + ".asp" _
  For Output _
  Access Write Lock Write _
  As HTMLFile
Else
  Open thisDoc.CustomDocumentProperties("ASPlocation").Value + "\" + Left(thisDoc.Name, Len(thisDoc.Name) - 4) + ".asp" _
  For Output _
  Access Write Lock Write _
  As HTMLFile
End If

you must ensure that if you use custom properties as above then the custom property cannot contain NULL and should be saved to the template (or you get an error and have to manually create and populate the custom property each time) Mark Saunders :)
 
Thanks. I think I got it figured out now. -Bronwyn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top