View Single Post
  #2  
Old October 26th, 2004, 11:10 PM
Jezebel
external usenet poster
 
Posts: n/a
Default

The UserName is contained in the Author field (should be, anyway) -- so you
can use { DocProperty Author } to insert it in a document. Computer name is
a little trickier -- it's not built in but it is available through the
Environ() collection. You'll need to create your own Document Property for
the purpose. Using VBA it would be something like --

ActiveDocument.CustomDocumentProperties.Add Name:="Computer", _
LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:=Environ("ComputerName")

Then in the document, use { DocProperty Computer } to display the value.





"Fred Holmes" wrote in message
...
Word 2003. WinXP

In the View: Header and Footer toolbar, there is an "Insert Autotext"
button with a list of handy information, including "Filename and
Path."

I'd like to expand this to add information as to the computer that the
document file exists on, e.g., the computer's network name or any
other readily available configuration variable. Or alternatively the
username of the currently logged on user.

If the working document were kept in "My Documents" (or even on the
desktop) the username in the path to "My Documents" would satisfy this
requirement, but in the company I'm working for, "C:\data\"
substitutes for "My Documents" and is set to be regularly backed up by
a network backup process, while "My Documents" is not. Since everyone
has a "C:\data\" directory, it isn't distinctive as to user. Perhaps
there is some way to parse the username out of the path to "My
Documents" or some such?

Thanks,

Fred Holmes