Private
Sub
Document_Open()
Dim
varQuery
As
String
Dim
objSystemInfo
As
Object
Dim
objBenutzer
As
Object
Set
objSystemInfo = CreateObject(
"ADSystemInfo"
)
varQuery =
"LDAP://"
& objSystemInfo.UserName
Set
objBenutzer = GetObject(varQuery)
ActiveDocument.Variables(
"Vorname"
).Value = objBenutzer.givenName
ActiveDocument.Variables(
"Initialen"
).Value = objBenutzer.initials
ActiveDocument.Variables(
"Nachname"
).Value = objBenutzer.sn
ActiveDocument.Variables(
"Anzeigename"
).Value = objBenutzer.DisplayName
ActiveDocument.Variables(
"Beschreibung"
).Value = objBenutzer.Description
ActiveDocument.Variables(
"Buero"
).Value = objBenutzer.PhysicalDeliveryOfficeName
ActiveDocument.Variables(
"Rufnummer"
).Value = objBenutzer.telephoneNumber
ActiveDocument.Variables(
"Email"
).Value = objBenutzer.mail
ActiveDocument.Variables(
"Webseite"
).Value = objBenutzer.wWWHomepage
ActiveDocument.Variables(
"Strasse"
).Value = objBenutzer.streetAddress
ActiveDocument.Variables(
"Postfach"
).Value = objBenutzer.postOfficeBox
ActiveDocument.Variables(
"Ort"
).Value = objBenutzer.l
ActiveDocument.Variables(
"Bundesland"
).Value = objBenutzer.st
ActiveDocument.Variables(
"Postleitzahl"
).Value = objBenutzer.postalCode
ActiveDocument.Variables(
"Land"
).Value = objBenutzer.CO
ActiveDocument.Variables(
"Benutzeranmeldename"
).Value = objBenutzer.sAMAccountName
ActiveDocument.Variables(
"RufnummernPrivat"
).Value = objBenutzer.homePhone
ActiveDocument.Variables(
"RufnummernPager"
).Value = objBenutzer.pager
ActiveDocument.Variables(
"RufnummernMobil"
).Value = objBenutzer.mobile
ActiveDocument.Variables(
"RufnummernFax"
).Value = objBenutzer.facsimileTelephoneNumber
ActiveDocument.Variables(
"RufnummernIPTelefon"
).Value = objBenutzer.ipPhone
ActiveDocument.Variables(
"Anmerkungen"
).Value = objBenutzer.info
ActiveDocument.Variables(
"Position"
).Value = objBenutzer.Title
ActiveDocument.Variables(
"Abteilung"
).Value = objBenutzer.department
ActiveDocument.Variables(
"Firma"
).Value = objBenutzer.company
ActiveDocument.Variables(
"Vorgesetzter"
).Value = objBenutzer.manager
ActiveDocument.Fields.Update
End
Sub