+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, Outlook has started throwing error when setting signature via vbscript in Coding and Web Development; I have been using a script I wrote about 4 years ago to set users' signatures on login. This has ...
  1. #1
    james.howell's Avatar
    Join Date
    Apr 2007
    Location
    Suffolk
    Posts
    6
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    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

  2. #2
    james.howell's Avatar
    Join Date
    Apr 2007
    Location
    Suffolk
    Posts
    6
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Seems an error had found its way into the script. The offending block should read:

    Code:
    objSignatureEntries.Add strSignatureName, objSelection
    objSignatureObjects.NewMessageSignature = strSignatureName
    objSignatureObjects.ReplyMessageSignature = strSignatureName

SHARE:
+ Post New Thread

Similar Threads

  1. Pro/Desktop 8. "the command has been aborted" error
    By 17thcpikeman in forum Educational Software
    Replies: 12
    Last Post: 17th April 2012, 02:04 PM
  2. Replies: 10
    Last Post: 4th September 2010, 08:50 AM
  3. Replies: 1
    Last Post: 11th August 2010, 03:06 PM
  4. Replies: 0
    Last Post: 19th September 2007, 02:02 PM
  5. Intermittant error when user logs into SIMS
    By Gatt in forum MIS Systems
    Replies: 6
    Last Post: 14th February 2007, 05:52 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •