Outlook has started throwing error when setting signature via vbscript
I have been using a script I wrote about 4 years ago to set users' signatures on login. This has worked fine until a couple of days ago when vbscript has started throwing an error:
Error: Object doesn't support this property or method: 'NewMessageSignature'
Code: 800A01B6
Source: Microsoft VBScript runtime error
I have stripped the rather long script down into the raw basics of generating a signature of a single word and adding it (no AD queries etc to interfere or cause problems). The signature is added and I can see it if I go into outlook under the signatures preferences, but the signature is not added for new or reply messages.
The block of code it falls over on is:
Code:
objSignatureEntries.Add strSignatureName, objSelection
objSignatureEntries.NewMessageSignature = strSignatureName
objSignatureEntries.ReplyMessageSignature = strSignatureName
I have not deployed any new WSUS updates around the time of this problem appearing, and the script has been unchanged for at least a year. This is happening on both Outlook 2007 and Outlook 2010.
Has anyone got any ideas or suggestions, or has anyone else started experiencing this problem?
Thanks,
James
Code:
Option Explicit
Dim objNet : Set objNet = CreateObject("WScript.NetWork")
Dim objFSO : set objFSO = createobject("Scripting.FileSystemObject")
Dim objShell : Set objShell = WScript.CreateObject("WSCript.shell")
Dim objWord : Set objWord = CreateObject("Word.Application")
Dim objDoc : Set objDoc = objWord.Documents.Add()
Dim objSelection : Set objSelection = objWord.Selection
Dim objEmailOptions : Set objEmailOptions = objWord.EmailOptions
Dim objSignatureObjects : Set objSignatureObjects = objWord.EmailOptions.EmailSignature
Dim objSignatureEntries : Set objSignatureEntries = objSignatureObjects.EmailSignatureEntries
objSelection.TypeParagraph
objSelection.TypeText "test"
Set objSelection = objDoc.Range()
Dim strSignatureName : strSignatureName = "test"
objSignatureEntries.Add strSignatureName, objSelection
objSignatureEntries.NewMessageSignature = strSignatureName
objSignatureEntries.ReplyMessageSignature = strSignatureName
objDoc.Saved = TRUE
objDoc.Close 0
objWord.Quit