Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Steven Heinz
 
Posts: n/a
Default Default field values from AD profile info??

We would like to generate a template that will default values in various
fields with information from an AD profile.

For example:
We have a Department field in the document. We want to set the department
field value = the Department value in the users AD profile.

How would this best be accomplished?

Thanks,
Steven


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Default field values from AD profile info??

Data manipulation is best done in the data source. What it it?

If the number of variations are not too great however, you can get by with
using If...then...Else... fields that provide the appropriate response
depending upon the value of the AD.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Steven Heinz" wrote in message
...
We would like to generate a template that will default values in various
fields with information from an AD profile.

For example:
We have a Department field in the document. We want to set the department
field value = the Department value in the users AD profile.

How would this best be accomplished?

Thanks,
Steven



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Default field values from AD profile info??

Assuming you mean Active Directory,

You should be able to get information from the AD provider using AD objects
in VBA. I know almost nothing about this except that you can, for eaxample,
get the logged-in user name using:

Dim objSysinfo, objUser
Set objSysinfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysinfo.UserName)

I would suggest that a good way forward might be to create AutoNew and/or
AutoOpen macros that query the AD and stuff the appropriate results into
either Document Properties or Document variables, and use { DOCPROPERTY } or
{ DOCVARIABLE } fields to insert the results into the document where you
need them. Document Properties are better if you want information that is
visible frm outside Word and which can be modified via the User Interface. I
think there may be a limit of 127, 255 or some such, on the number
available. Docvariables are better if you don't want to allow users to
change their values. I think you can have more of them if that's what you
need, but { DOCVARIABLE } fields used to crash Word when used in
headers/footers in older versions of Word. (I don't think they do now, but
it's probably worth checking).

Alternatively, it is possible to use the OLEDB provider for the AD to use AD
as a Word mailmerge data source. e.g. in code

ActiveDocument.MailMerge,OpenDataSource _
Name:="c:\a\empty.odc", _
Connection:="Provider=ADSDSOObject;", _
SQLStatement:="SELECT * FROM 'LDAP://adsiservername'"

where empty.odc is a completely empty file that you can create in e.g.
Notepad, and adsiservername is the name of the adsi server box.
You can also get such data directly into a document using a DATABASE field
along similar lines, e.g.

{ DATABASE \d "c:\\a\\empty.odc" \c "Provider=ADSDSOObject;"

\s "SELECT * FROM 'LDAP://adsiservername'" }

Again, I don't know enough about ADSI/LDAP structure and query syntax to
know whether you can get info. for the current user without getting the
current user as a preiliminary step.

If you do make progress with any of these approaches it would be pretty
useful if you could post code examples back in this newsgroup.

Peter Jamieson

"Steven Heinz" wrote in message
...
We would like to generate a template that will default values in various
fields with information from an AD profile.

For example:
We have a Department field in the document. We want to set the department
field value = the Department value in the users AD profile.

How would this best be accomplished?

Thanks,
Steven



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter text in a field and have it appear as entered elsewhere Gregory Winters Microsoft Word Help 6 November 1st 05 02:09 AM
How do I set default on Toggle Field Codes? BoulderRon Microsoft Word Help 1 March 7th 05 04:25 PM
how to change "default text" font in a form field Angela Microsoft Word Help 1 January 29th 05 05:03 AM
Default font - possible bulletproof fix in Word 2003 [email protected] Microsoft Word Help 0 January 14th 05 09:14 PM
Text Form Field Ref in Footer Won't Update on Screen StarWine Microsoft Word Help 3 December 6th 04 06:17 PM


All times are GMT +1. The time now is 10:06 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"