John
2007-04-20 20:58:00 UTC
I came across the script below in an issue of TechNet and have been testing
it ever since so that I can actually use it. I'm not very familiar with
scripting, but from playing with the code in this was able to figure out what
is what. I would like to tweak it to do a couple more things but have not had
much luck figuring these options out. If possible I’d like to have the e-mail
address be an actual link that will bring up a new e-mail with the address in
the “To:” field, I’d like to insert a logo and have it link to a website,
insert another phone number (mobile), show the address (or another filed from
AD that I could put the address in) and last but not least on the cosmetic
side I’d like to use a different font style and color.
Thanks for any help!
Here the code I have
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
strOffice = objUser.Office
strMail = objUser.mail
Set objWord = CreateObject("Word.Application")
objWord.Visible = false
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.TypeText strName
objSelection.TypeParagraph()
objSelection.TypeText strTitle
objSelection.TypeParagraph()
objSelection.TypeText strDepartment
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strPhone
objSelection.TypeParagraph()
objSelection.TypeText strmail
Set objSelection=objDoc.Range()
objSignatureEntries.Add "AD Signature", objSelection
objSignatureObject.NewMessageSignature = "AD Signature"
objSignatureObject.ReplyMessageSignature = "AD Signature"
objDoc.Saved = true
objWord.Quit
it ever since so that I can actually use it. I'm not very familiar with
scripting, but from playing with the code in this was able to figure out what
is what. I would like to tweak it to do a couple more things but have not had
much luck figuring these options out. If possible I’d like to have the e-mail
address be an actual link that will bring up a new e-mail with the address in
the “To:” field, I’d like to insert a logo and have it link to a website,
insert another phone number (mobile), show the address (or another filed from
AD that I could put the address in) and last but not least on the cosmetic
side I’d like to use a different font style and color.
Thanks for any help!
Here the code I have
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
strOffice = objUser.Office
strMail = objUser.mail
Set objWord = CreateObject("Word.Application")
objWord.Visible = false
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.TypeText strName
objSelection.TypeParagraph()
objSelection.TypeText strTitle
objSelection.TypeParagraph()
objSelection.TypeText strDepartment
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strPhone
objSelection.TypeParagraph()
objSelection.TypeText strmail
Set objSelection=objDoc.Range()
objSignatureEntries.Add "AD Signature", objSelection
objSignatureObject.NewMessageSignature = "AD Signature"
objSignatureObject.ReplyMessageSignature = "AD Signature"
objDoc.Saved = true
objWord.Quit
--
Thanks,
John
Thanks,
John