I put this together from lots of places. Thanks to all who have gone before me.
Email me if you have any qu's
schambers@barloworld.com.au
'*****************************************
' Script to set signature using Active
' Directory fields.
' Only works when connected to Active
' Directory
'
' Written By: Steve Chambers
' Date: 13/09/07
'
'*****************************************
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
strFax = objUser.Faxnumber
strstreetAddress = objUser.streetAddress
strl = objUser.l
strst = objUser.st
strpostalCode = objUser.postalCode
strmail = objUser.mail
strwWWHomePage = objUser.wWWHomePage
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.Font.Name = "Arial"
objSelection.Font.Size = "16"
objSelection.TypeText strName
objSelection.TypeParagraph()
objSelection.Font.Size = "12"
objSelection.TypeText strTitle
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strstreetAddress
objSelection.TypeParagraph()
objSelection.TypeText strl
objSelection.TypeParagraph()
objSelection.TypeText strst
objSelection.TypeText ", "
objSelection.TypeText strpostalCode
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.TypeText "Phone: "
objSelection.TypeText strPhone
objSelection.TypeParagraph()
objSelection.TypeText "Fax: "
objSelection.TypeText strFax
objSelection.TypeParagraph()
objSelection.TypeText "Email: "
objSelection.TypeText strmail
objSelection.TypeParagraph()
objSelection.TypeText "Web: "
objSelection.TypeText strwWWHomePage
objSelection.TypeParagraph()
objSelection.TypeParagraph()
Set objShape = objSelection.InlineShapes.AddPicture("\\bwm\root\Source\Signatures\Images\glw_gm_2.bmp")
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.Font.Size = "10"
objSelection.TypeText "This correspondence is for the named person/s use only and may contain confidential or legally privileged information or both. If you receive this correspondence in error, please notify the sender and then immediately delete it from your system. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of the company. "
Set objSelection = objDoc.Range()
objSignatureEntries.Add "AD Signature", objSelection
objSignatureObject.NewMessageSignature = "AD Signature"
objSignatureObject.ReplyMessageSignature = "AD Signature"
objDoc.Saved = True
objWord.Quit