One question I'm often asked about stationery is how to apply it to replies and forwards. This is not possible using native Outlook features, as Outlook uses the same format for replies and forwards that was used in the original message.
However, you can use a macro to insert an HTML stationery file into replies, forwards, or even new messages you are composing. (You can also use this method to insert 'boilerplate' text files.)
You can insert stationery into a reply in the reading pane. The HTML file can include background colors and any images must be in the code using the full path to the image.
Because the theme is inserted into the file, your cursor may be 'invisible' when you type. It eventually comes back but if you are in a hurry to see the flashing cursor, you can save and reopen the message.
This code uses the Scripting Runtime to read the HTML file. You'll need to set a reference to it in the VB Editor's Tools, References dialog.
Do you want to create new messages using a specific stationery without using the More Stationery dialog? See Insert an HTML file or Stationery into a New Message.
To use this macro, add the code to the VB Editor and edit the file name. Open a new message and create a button on the ribbon for this macro. When you want to use the stationery, click the button.
While you can set the stationery automatically when you click reply, the messages may be messy and difficult to read. If you want to automatically apply the stationery, VBA Sample: Do something when Reply is clicked shows how to 'do something'. You'll need to put it together with this code.
Sub InsertStationery() ' You need to set a reference to the scripting object Dim fso As Scripting.FileSystemObject Dim tsTextIn As Scripting.TextStream Dim strTextIn As String Dim strInsert As String Dim fsoFile As Scripting.File Dim fsoFldr As Scripting.Folder Dim dtNew As Date, sNew As String Dim enviro As String enviro = CStr(Environ("USERPROFILE")) ' your stationery file strFile = enviro & "\AppData\Roaming\Microsoft\Stationery\compass.htm" Set fso = New Scripting.FileSystemObject 'read html Set tsTextIn = fso.OpenTextFile(strFile) strTextIn = tsTextIn.ReadAll 'Use open e-mail item Set objMail = Application.ActiveInspector.CurrentItem With objMail ' copy the original message body strInsert = .HTMLBody ' add the stationery file .HTMLBody = strTextIn 'add the original message body back .HTMLBody = .HTMLBody & strInsert .Display End With End Sub
Inline reply (Reading Pane)
You can insert stationery (or text files containing boilerplate text) into a reading pane reply using the following code. If the HTML file contains images, they need to be linked using the full path to the file, like this:
<body background="C:\path\to\image.gif" bgcolor="#C9B49A">
This code goes in ThisOutlookSession.
Dim myOlApp As New Outlook.Application Public WithEvents myOlExplorer As Outlook.Explorer Public Sub Initialize_handler() Set myOlExplorer = myOlApp.ActiveExplorer End Sub Private Sub myOlExplorer_InlineResponse(ByVal Item As Object) ' do things to the Item here in the inline response Dim fso As Scripting.FileSystemObject Dim tsTextIn As Scripting.TextStream Dim strTextIn As String Dim strInsert As String Dim fsoFile As Scripting.File Dim fsoFldr As Scripting.Folder Dim enviro As String enviro = CStr(Environ("USERPROFILE")) ' your stationery file strFile = enviro & "\AppData\Roaming\Microsoft\Stationery\pawprint.htm" Set fso = New Scripting.FileSystemObject 'read html Set tsTextIn = fso_OpenTextFile(StrFile) strTextIn = tsTextIn.ReadAll Item.HTMLBody = strTextIn & Item.HTMLBody End Sub
Outlook's Stationery and Theme Files
Office uses several locations for stationery files.
User-created HTML files that are listed in the More Stationery dialog list are stored at
C:\Users\username\AppData\Roaming\Microsoft\Stationery. You can open this folder by typing %appdata%\microsoft\stationery in the address bar of Windows Explorer and pressing Enter. You can copy your custom stationery to this location so it's accessible using the macro or using the Stationery picker.
Microsoft installs the default Stationery in these locations:
C:\Program Files\Common Files\microsoft shared\Stationery
C:\Program Files (x86)\Common Files\Microsoft Shared\Stationery
C:\Program Files (x86)\Microsoft Office\root\Stationery\
If you want to use one of the default stationeries with this macro, you'll need to edit the image filepath. I recommend copying the HTML file and background image to the user's stationery folder before editing the image filepath.
The More Stationery dialog box includes themes, which cannot be applied using VBA. (These themes are stored under the Office installation folder at \Microsoft Shared\THEMES*\. For example, in Office 2013 32-bit, the Compass theme is at C:\Program Files (x86)\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\THEMES15\COMPASS.)
If you want to use one of the themes as your stationery, you'll need to create a new message and save it as HTML, then edit the HTML and enter the full path to the images in the HTML. Open the HTML file in Notepad then scroll to the bottom for the file. Change the filepath for the background and remove the xml code from the body tags, leaving code similar to this:
How to use macros
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor