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

Word Macro

Status
Not open for further replies.

ihaveaproblem

Programmer
Jul 4, 2003
14
GB
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.



 
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.
 
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.
--MiggyD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top