B
benb
Hi,
In this months TechNet magazine, there is a couple of pages on scripting
signatures in outlook. One of the sample scripts is a vbscript that queries
active directory, pulls out the user info and then inserts it as a
signature. However the article doesn't say how to set this script up in
outlook. I've tried just adding the script to a signature, but when you
insert the signature it just displays the script. How do I assign the script
to the signature so that it will work correctly?
Many thanks
Ben
P.S. Script is below
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strTitle = objUser.Title
strDepartment = objUser.Department
strCompany = objUser.Company
strPhone = objUser.TelephoneNumber
Set objWord = GetObject("Word.Application")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObjects = objWord.EmailOptions.EmailSignature
Set objSignatureEntries = objWordSignatureObjects.EmailSignatureEntries
objSelection.TypeText strName & ", " & strTitle
objSelection.TypeParagraph()
objSelection.TypeText strDepartment
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strPhone
Set objSelection = objDoc.Range()
objSignatureEntries.Add "AD Signature", objSelection
objSignatureObjects.NewMessageSignature = "AD Signature"
objSignatureObjects.ReplyMessageSignature = "AD Signature"
objDoc.Save = True
objWord.Quit
In this months TechNet magazine, there is a couple of pages on scripting
signatures in outlook. One of the sample scripts is a vbscript that queries
active directory, pulls out the user info and then inserts it as a
signature. However the article doesn't say how to set this script up in
outlook. I've tried just adding the script to a signature, but when you
insert the signature it just displays the script. How do I assign the script
to the signature so that it will work correctly?
Many thanks
Ben
P.S. Script is below
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strTitle = objUser.Title
strDepartment = objUser.Department
strCompany = objUser.Company
strPhone = objUser.TelephoneNumber
Set objWord = GetObject("Word.Application")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObjects = objWord.EmailOptions.EmailSignature
Set objSignatureEntries = objWordSignatureObjects.EmailSignatureEntries
objSelection.TypeText strName & ", " & strTitle
objSelection.TypeParagraph()
objSelection.TypeText strDepartment
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strPhone
Set objSelection = objDoc.Range()
objSignatureEntries.Add "AD Signature", objSelection
objSignatureObjects.NewMessageSignature = "AD Signature"
objSignatureObjects.ReplyMessageSignature = "AD Signature"
objDoc.Save = True
objWord.Quit