Solved: Word to outlook font problem I've written a vbscript which takes some information from active directory and generates an email signature in outlook.
It works by making the signauture in word and then creating it in outlook.
I am creating an email signature by extracting details from active directory
The problem I am having is when I create the sig in word and specify the font as arial it goes to calibra (body) in outlook.
I have arial as my default font in word, if I change it to not be the default then it works in outlook, so I think outlook is just seeing arial as default and then using its own default, which is calibra.
So, can I change the default font in outlook to arial or is there another fix?
The code I am using:
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
' Grab some of the users details from AD
strFirstName = objUser.FirstName
strSurName = objUser.LastName
strTitle = objUser.Title
strCompany = objUser.Company
strPhone = objUser.telephoneNumber
strDirect = objUser.homeNumber
strEmail = objUser.mail'
' Create MS Word Document
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
' Start Text area selection & choose email signature options
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
' Setup Font and type style & Include variables from AD
objSelection.Font.Name = "Arial"
objSelection.Font.Size = 8
objSelection.Font.Bold = 1
objSelection.TypeText strFirstName & " " & strSurName & vbCrLf
objSelection.TypeText strTitle
objSelection.TypeParagraph()
objSelection.Font.Bold = 0
objSelection.TypeText "Tel: " & strPhone
objSelection.TypeParagraph()
objSelection.TypeText "Direct Dial: " & strFax
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.TypeText "Email: " & strEmail
Set objSelection = objDoc.Range()
' Update Outlook with the new signature and set as default
objSignatureEntries.Add "AD Signature", objSelection
objSignatureObject.NewMessageSignature = "AD Signature"
objSignatureObject.ReplyMessageSignature = "AD Signature"
objDoc.Saved = True
objWord.quit
I also have a problem that word 2007 is using normal spacing and I need to have no spacing in the signature.
Edit:
Solved the spacing by adding objSelection.Style = "No Spacing"
I also moved the font declaration to after Set objSelection = objDoc.Range() which add some hyperlinks I added the correct font and size aswell as all the rest.
Last edited by Gudzy : 09-Jun-2009 07:49 AM.
|