Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Word Macro

Word Macro

Word Macro

I have a series of documents which include an address as part of the main body.  However these documents are stored on servers in a number of regional offices.

Does anybody know how I could create a Macro/some VBA code to identify where each user is based and insert the correct address.

Ideas I came up with was A)somehow grabbing a users nt sign-on detials the cross referencing it with another database which containts their location. or

B) Promp the user to select their location before printing the document and inserting the relevant address,

Any help to get me started on this would be appreciated.


RE: Word Macro

What ive done in this case, is install a local environment variable (LEV) to their pc via a log on script...
This log-in script calls a .REG file that embeds a value to the LEV which has the value of the office you wish....

in Win2000 go to mycomputer>properties>advanced>enviorment variables. Add a system variable and close. then export this
variable via regedit at:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] "yourvariable"

you can install this .REG file on other pc's silently by
regedit -s "X:\XXXXX.reg"

this way you can write your batch to call %officelocation%
and get the value you need and be unique per office pc.

let me know if didnt make this clear.

RE: Word Macro

I would go along with "A".

If the person moves/gets promoted to another facility/or the facility is relocated elsewhere, it would be easier to update that database.  Where as in "B", you would have to locate each doc and update them individually.

Good luck.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close