Update to Adding Outlook Signatures (Outlook 2000 Fix) …

A little while ago I posted an article on how you can create signatures for Outlook using VBSCRIPT which seemed to function very well until a chap called Josh mailed me and let me know that although it worked great for Outlook 2002, 2003 and 2007 – when using it with Outlook 2000 it failed terribly.

I thought that this was somewhat odd, and tested it out and sure enough – it did not work for Outlook 2000, it would seem that there is an in-compatibility between the Outlook 2000 API and the scripting commands that I was using.

We Exchanged a couple of e-mails, and after a lot of messing about I think that I have come up with a fix to the original script, all that is needed on a target machine is Outlook and MS Word (which should be the case with most modern client machines).

You can download the updated code here, or have a look below – please note that you are advised to download the code file due to formatting issues on the site with copy and paste.

This version of the code and been tested with all versions of Outlook.

I would like to personally thank Josh for bringing this to my attention – Josh, this one is for you!

Const RTF = 6
Const Text = 4
Const HTML = 8

strName = InputBox(”Please Provide Your Name”)

strTitle = InputBox(”Please Provide Your Job Title”)
strDepartment = InputBox(”Please Provide Your Department”)
strCompany = InputBox(”Please Provide Your Company”)
strPhone = InputBox(”Please Provide Your Full Phone Number”)
strMail = InputBox(”Please Provide Your e-Mail Address”)
strWeb = InputBox(”Please Provide Your Web Address”)

set outlook = createobject(”outlook.application”)

If outlook.version = “9.0.0.2711″ or outlook.version = “9.0.0.3011″ or outlook.version = “9.0.0.3821″ or outlook.version = “9.0.0.4105″ or outlook.version = “9.0.0.4201″ or outlook.version = “9.0.0.4527″ or outlook.version = “9.0.0.5414″ Then

’Wscript.Echo “Outlook 2000″
olk2000 = True

End If

If olk2000 = True Then
Set wshShell = WScript.CreateObject(”WScript.Shell” )
StrProfile = WshShell.ExpandEnvironmentStrings(”%USERPROFILE%”)+”\Application Data\Microsoft\Signatures\”


Set objWord = CreateObject(”Word.Application”)
objWord.Visible = False

Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

objSelection.Font.Name = “Arial”
objSelection.Font.Size = “12″
objSelection.Font.Bold = True
objSelection.TypeText strName
objSelection.TypeParagraph()

objSelection.Font.Size = “11″
objSelection.Font.Bold = False
objSelection.TypeText strDepartment
objSelection.TypeParagraph()

objSelection.Font.Size = “11″
objSelection.Font.Bold = False
objSelection.TypeText strCompany
objSelection.TypeParagraph()

objSelection.Font.Size = “11″
objSelection.Font.Bold = False
objSelection.TypeText strPhone
objSelection.TypeParagraph()

objSelection.Font.Size = “11″
objSelection.Font.Bold = False
objSelection.TypeText strMail
objSelection.TypeParagraph()

objSelection.Font.Size = “11″
objSelection.Font.Bold = False
objSelection.TypeText strWeb

objDoc.SaveAs strProfile & “Default.rtf”, RTF
objDoc.SaveAs strProfile & “Default.txt”, Text
objDoc.SaveAs strProfile & “Default.htm”, HTML

objWord.Quit

Else
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.TypeText strName & “, ” & strTitle

objSelection.TypeParagraph()
objSelection.TypeText strDepartment
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strPhone
objSelection.TypeParagraph()
objSelection.TypeText strMail
objSelection.TypeParagraph()
objSelection.TypeText strWeb
Set objSelection = objDoc.Range()
objSignatureEntries.Add “MyDefaultSig”, objSelection

objSignatureObject.NewMessageSignature = “MyDefaultSig”
objSignatureObject.ReplyMessageSignature = “MyDefaultSig”
objDoc.Saved = True

objWord.Quit
End if
Wscript.Echo “Script Completed”
Sharing is caring!:

Leave a Reply

Your email address will not be published. Required fields are marked *