|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Outllok 2003 Signature script
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 John,
Based on the code below, you're starting to dive into VB for Apps (creating a word doc for your signature). I don't have a simple answer for you via specific code, but recomened you take a look at the VB Editor (macro editor) interface within Word or Outlook (Alt+F11). It's really a lot more than just a macro editor. You can open up the object libraries for each app and get some good code examples to accomplish what you are looking for. Depending one which app you open it within, Word or Outlook, you'd most likely need to add the appropriate reference libraries. This can be done via the Tools/References menu. Ex., if in Outlook you will need to add Word. In OFF2K7, Words likbraries are refered to as "Microsoft Word 12.0 Object Library". If you are looking for a quicker solution, you may also want to check out Desktop Authority, www.scriptlogic.com/da. It will automatically leverage user inforamtion in AD to provide some great Outlook signature templates. Also has a built in editor which allows you to setup the email address as a mailto hyperlink as well as adjust font size, type, color... http://www.scriptlogic.com/products/DesktopAuthority/walkthrough-da/I-2-Outlook-General.asp Best, Show quote "John" <J***@discussions.microsoft.com> wrote in message news:99EF6A85-5939-457B-817A-99D760E350AB@microsoft.com... >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 > 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 just add this
objSelection.Font.name = "Arial" objSelection.Font.Size = 12 objSelection.Font.Bold = True in where the text is being typed ... like so On Error Resume Next Set objSysInfo = CreateObject("ADSystemInfo") strUser = objSysInfo.UserName Set objUser = GetObject("LDAP://" & strUser) strTitle = objUser.Title strName = objUser.FullName strDepartment = objUser.Department strCompany = objUser.Company strPhone = objUser.telephoneNumber 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 = 12 objSelection.Font.Bold = True objSelection.TypeText strTitle & ", " & strName objSelection.TypeParagraph() objSelection.Font.Bold = False objSelection.TypeText strDepartment objSelection.TypeParagraph() objSelection.TypeText strCompany objSelection.TypeParagraph() objSelection.TypeText strPhone objSelection.TypeParagraph() Set objSelection = objDoc.Range() objSignatureEntries.Add "AD Signature", objSelection objSignatureObject.NewMessageSignature = "AD Signature" objSignatureObject.ReplyMessageSignature = "AD Signature" objDoc.Saved = True objWord.Quit -- xizero ------------------------------------------------------------------------ xizero's Profile: http://forums.techarena.in/member.php?userid=33203 View this thread: http://forums.techarena.in/showthread.php?t=733065http://forums.techarena.in |
|||||||||||||||||||||||