'Setting The Default Signature Via VBA

I've researched as best as I can on this subject and am unable to find a way of switching the default signature programmatically via VBA.

I would like to be able to set a default signature depending on what day of the week it is (I work at two different locations). When Outlook starts up I'd like it to change the default signature to the one I specify.

I'm starting to think this isn't possible at all.



Solution 1:[1]

The Outlook object model doesn't provide anythyng for signatures. But you can edit the message body at runtime using VBA macros.

The Outlook object model provides three main ways for working with item bodies:

  1. Body - a string representing the clear-text body of the Outlook item.
  2. HTMLBody - a string representing the HTML body of the specified item.
  3. Word editor - the Microsoft Word Document Object Model of the message being displayed. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model which you can use to set up the message body.

You can read more about all these ways in the Chapter 17: Working with Item Bodies. It us up to you which way is to choose to customize the signature in the message body.

P.S. If you change accounts in Outlook the signatures are changed as well. You may consider assigning different signatures for each account in Outlook.

Solution 2:[2]

Outlook signatures are set on the per account basis in profile data (stored in the registry). You can see the data in OutlookSpy (I am its author) - click IOlkAccountManager button and double click on the account.

IOlkAccountManager can be accessed only in C++ or Delphi. If using Redemption (I am also its author) is an option (it can be used from any language, including VBA or .Net), it exposes the RDOAccount.ReplySignature and NewMessageSignature properties.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2