Set signatures in Outlook for multiple accounts using Vb script RRS feed

  • Question

  • Hi, I'm new to VB script and need your help.  I saw many posts setting signatures in outlook using AD info. But I want to set html file as signature for different accounts.  I have two accounts in one profile. I have two issues. 

    - I'm not able to set html file as signature. 

    - signature is not set for secondary mail account. 

    Following is my code. 

    Set objWord = CreateObject("Word.Application") 
    Set objNewSignature = objWord.Documents.Add(oAppData & "\Microsoft\Signatures\Default.htm")
    Set objReplySignature = objWord.Documents.Add(oAppData & "\Microsoft\Signatures\Return.htm")
    Set objSelectionDefault = objNewSignature.Range()
    Set objSelectionReturn = objReplySignature.Range()
    Set objEmailOptions = objWord.EmailOptions
    Set objSignatureObjects = objWord.EmailOptions.EmailSignature
    Set objSignatureEntries = objSignatureObjects.EmailSignatureEntries
    objSignatureEntries.Add "Default", objSelectionDefault
    objSignatureEntries.Add "Return", objSelectionReturn
    objSignatureObjects.NewMessageSignature = "Default"
    objSignatureObjects.ReplyMessageSignature = "Return"

    Default and Return is a html file that has template customized. 

    This creates a txt, rtf files and appends (Default and Return htm)  as plain text in mailbody which should be a html content. Could someone help me how to set a html file as signature and how to set different signatures for different user accounts. Thanks in advance. 

    • Moved by Bill_Stewart Wednesday, September 4, 2019 9:27 PM This is not "scripts on demand"
    Wednesday, April 17, 2019 1:34 PM

All replies

  • You have to create a signature before creating the files. The signature is a Word object and no a word file.  Word will automatically create all of the necessary file in all formats when the signatures are assigned.

    Search the Gallery for numerous scripts that create email signatures.


    • Edited by jrv Wednesday, April 17, 2019 6:31 PM
    Wednesday, April 17, 2019 6:30 PM
  • Hi, Thanks for the reply. I have already created signature files without using AD. Now I want to use those html file and assign them to my accounts. 
    Wednesday, April 24, 2019 8:22 AM
  • Please look in the Gallery for scripts that do this correctly.  The code you have is not correct.  There is no need to create HTML files.  Word creates them for you.

    Microsoft Script Gallery


    Wednesday, April 24, 2019 8:26 AM
  • Hi, I couldn't find any scripts that sets html file as signatures but I have been following your previous post "VBScript - How to set the wanted file as the Outlook Email Signature ".  But I don't want the code to create any signatures. I already have created signature file and moved to my local outlook folder. I don't understand how to assign them to my mail account like Set NewMessageSignature = "path_to_htmlfile". I'm sorry that I'm not getting your point.  
    Wednesday, April 24, 2019 9:31 AM
  • That is my point.  You can't.  You must create the signature set in the correct folder.  That is client dependent and is resolved by Word.

    You can distribute signature files via GPO.  Ask in GP forum for links to how to do this. 


    Wednesday, April 24, 2019 9:34 AM
  • Here is how to do this in modern Exchange: https://www.howto-outlook.com/howto/corporatesignatures.htm


    Wednesday, April 24, 2019 9:36 AM
  • Wednesday, April 24, 2019 9:37 AM
  • Thanks for your help. I will definitely look into it. Also I have a doubt, Is there a option to set multiple signatures for multiple accounts using vbscript.  
    Wednesday, April 24, 2019 9:48 AM
  • Thanks for your help. I will definitely look into it. Also I have a doubt, Is there a option to set multiple signatures for multiple accounts using vbscript.  

    I think you need to learn about what scripting is.  It is allow level programming system.  It can only do what the system offers to it.  With Outlook the only method to set up signatures with script is per-user.  There is no "batch" method.

    I recommend that you contact a trained consultant to help you understand how to set up signatures in an organization.  This is not really an end user thing and requires sufficient technical training in the required systems to be able to design and implement a solution. You will also need to inventory the versions and applications of the needed subsystems to design a solution. Most scripts you will find are fo a single instance of Outlook and not really useful in an organization.

    The current versions of Exchange make all of this much simpler because we can design a set of add-ons to the email that can add a pre-element and post-element in HTML to an email which can be applied using rules.  The Exchange method is preferred and can reference AD information per user.

    Your current ideas with VBScript were devised for early versions of Exchange and Outlook.  The current versions will not work well or at all with the old VBScript methods.  Also VBScript is now mostly obsolete.

    The correct solution for your organization can really only be discovered by working with a trained consultant for Exchange/AD and Outlook.  Anything else will likely become an ongoing headache.


    Wednesday, April 24, 2019 12:18 PM