Using VBScript to select current signature for Outlook 2007/2010

Posted on 2010-09-16
Last Modified: 2012-05-10
Does Outlook 2010 handle signatures differently than it does 2003?

I cannot figure out how to assign a signature to Outlook, using VBScript, in 2007, 2010 versions.

The signature is created in the correct folder, the changes appear in the registry, but still it defies me.

It will replace the existing signature that we have set up (AD Signature) if I run this script with the "strSigVersion = AD Signature" but will not switch to a new one with a different name (ex: "strSigVersion = AD SignatureV1") when the script is run.

What must I do?

(It works in Outlook 2003)

On Error Resume Next

Set objShell = WScript.CreateObject("WScript.Shell")
strUserName = objShell.ExpandEnvironmentStrings("%username%")
If Not objExclude.Exists(strUserName) Then

'>>>Creates Email Signature

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strTitle = objUser.Title
strAddress = objUser.streetAddress
strCity = objUser.l
strState =
strZip = objUser.postalCode
strCompany = objUser.Company
strPhone = objUser.telephoneNumber
strTfree = objUser.otherTelephone
strFax = objUser.faxNumber
strExt = objUser.ipPhone
strEmail = objUser.mail
strWeb = objUser.wWWHomePage
strMobile =
strSAMAccountName = objuser.sAMAccountName

strSigVersion = "AD Signature"

Set objShell = CreateObject("WScript.Shell")
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\NewSignature" , strSigVersion
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\ReplySignature" , strSigVersion
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\EnableLogging" , "0", "REG_DWORD"

objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\MailSettings\NewSignature" , strSigVersion
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\MailSettings\ReplySignature" , strSigVersion
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail\EnableLogging" , "0", "REG_DWORD"
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\MailSettings\NewSignature" , strSigVersion
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\MailSettings\ReplySignature" , strSigVersion
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Options\Mail\EnableLogging" , "0", "REG_DWORD"

'Const wdColorBlack = 0
'Const wdColorRed = 128
'Const wdColorYellow = 32896
'Const wdColorBlue = 8388608

Const wdColorOrange = &H1168B7
Const wdColorBlue = &H4A2500

'objSelection.Case = wdUpperCase

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 = "Times New Roman"
objSelection.Font.Size = 12
objSelection.Font.Color = wdColorBlue
objSelection.Font.Bold = True
objSelection.Font.SmallCaps = True 
objSelection.TypeText strName & chr(11)

objSelection.Font.Size = 10
objSelection.Font.Bold = False
objSelection.Font.Color = wdColorOrange

objSelection.Font.Size = 12
objSelection.Font.Color = wdColorBlue
objSelection.Font.Bold = True
objSelection.TypeText strCompany & chr(11)
objSelection.Font.Bold = False
objSelection.Font.Size = 10
objSelection.Font.Color = wdColorOrange 
objSelection.TypeText strAddress & chr(11)
objSelection.TypeText strCity & ", " & strState & "  " & strZip
objSelection.Font.SmallCaps = False
objSelection.TypeText " " & chr(11) & chr(11)

objSelection.Hyperlinks.Add objSelection.Range,"mailto:" & strEmail,, strEmail, strEmail & chr(11)
objSelection.Font.SmallCaps = False
objSelection.Font.Color = wdColorBlue
objSelection.TypeText strPhone & " - Direct"  & chr(11)
If strMobile <> "" Then 
objSelection.TypeText strMobile & " - Mobile"  & chr(11)

End If
objSelection.TypeText strTfree & ", Ext. " & strExt & " - Toll Free"  & chr(11)
objSelection.TypeText strFax & " - Fax" & chr(11)

objSelection.Font.Color = wdColorOrange
objSelection.TypeText "Click this! Visit "
objSelection.Font.Color = wdColorBlue
objSelection.Hyperlinks.Add objSelection.Range,"http://" & strWeb,, "Visit our website", strWeb

objSelection.TypeText chr(11) & chr(11)
Set objSelection = objDoc.Range()
objSignatureEntries.Add strSigVersion, objSelection
objSignatureObject.NewMessageSignature = strSigVersion
objSignatureObject.ReplyMessageSignature = strSigVersion
objDoc.Saved = True

End If

Open in new window

Question by:alterniTECH
1 Comment

Accepted Solution

alterniTECH earned 0 total points
ID: 33695785

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you don't know how to downgrade, my instructions below should be helpful.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question