Thursday, August 7, 2014

Format text in a reply with the click of the mouse

In an earlier post, I explained how to make new messages look the way you want in Outlook. This post shows how to accomplish similar goals in replies and forwards.


Outlook uses the original message’s formatting in replies and forwards

First, despite all the work you may have put into templates, themes, styles, and stationery, it won't do you any good for your replies and forwards. That's because Outlook uses the formatting from the original message for the styles and the initial setting on your reply or forward.

Be careful about formatting replies

The most basic formatting option in Outlook is whether the message is formatted in html, rich text, or plain text. Some smartphones and other devices still cannot read or send in html, so Outlook's behavior makes the most sense when dealing with those messages. You shouldn't spend any time formatting a message replying to someone who is reading and replying to your messages on one of those devices because the reader won't see a difference and might even get annoyed. One of the pages I cite below talks more about why you shouldn't change the format in these situations.

All those netiquette reasons for replying in the same basic format as the original sender don't apply when you're forwarding the message. They don't usually apply when the basic format is rich text. And they certainly don't apply when the basic format is html.

Make sure you’re editing in html

Once you've decided it's OK to format your message in html, make sure the message is set to that format. Your message will look and behave much better that way. The option is on the Format Text tab of the message window.


Why can't I just apply my styles from my style set?

You may ask why you can't apply the style set from your default new message to your replies and forwards. The reason is simple and frustrating. Changing the theme's fonts or default styles like Normal will change the formatting of the text in the previous messages. You don't want to do that because it looks like you've edited someone else's messages. You have three options: use the formatting that comes with the original message with the styles you see, manually change your formatting in your text, or set Outlook not to send any of the preceding material. Of course if you choose option three, you wouldn't end up looking to solve these problems in the first place.

If you're like me, you want your text to look just right. My law firm has, for the time being, mandated that all e-mails use the Calibri typeface. I want my audience to find this readable on screen, so I use 14-point Calibri, 8 points after each paragraph, and 18.5-point line spacing. If I'm replying to someone who uses Times New Roman 12 for e-mail messages, that's four changes, two of which require using the paragraph dialog box on the Formatting Text Tab.

So I searched and found how to accomplish this with a macro.

A word about macros

Outlook doesn't have the very user-friendly feature in other Office programs to record a macro. That can make a good V.B.A. programmer out of the uninitiated. But it does use the same language as Word, so that's a good place to start. If there are formatting options you want to incorporate into the macro below that I haven't, just record a macro in Word's V.B.A. editor and copy the language to Outlook's V.B.A. editor.

The other thing about this macro is that it requires the user to run it; it doesn't run automatically like the macro in my earlier post that deletes the extra line or two before a signature. But you don't want this macro to run automatically with every new reply or forward because some of those will be plain text, and you'll get an error message if it runs that way. But if you do want to make all replies html, check out this post: http://www.outlook-tips.net/how-to/change-reply-format/ That will lead you to this post, which contains the V.B.A. language: http://www.outlook-tips.net/code-samples/always-reply-using-html-code-sample/. I have not tried these out, but the first post made me realize why I didn't want to make this an automatic step for all my replies and forwards.

The macro that collects all your formatting

This macro is a combination of things I picked up from this post on using a Word macro to format the text's font and this post on using a Word macro to format the text's paragraph formatting. Other parts I picked up from Word's V.B.A. editor after recording the changes I wanted. For instance, I didn't know how to make the text color set to Automatic, so I ran that through Word's macro recorder.

As you might guess from the explanation above, this macro sets the selected text (the first line if you've just opened the new message) to Calibri 14-point font with exactly 18.5-point line spacing and 8 points of space after each paragraph.

Paste this into a new or existing Module (not Class Module) in Outlook's V.B.A. editor:
   Public Sub FormatSelectedText()
    Dim objItem As Object
    Dim objInsp As Outlook.Inspector
     
    ' Add reference to Word library
    ' in VBA Editor, Tools, References
    Dim objWord As Word.Application
    Dim objDoc As Word.Document
    Dim objSel As Word.Selection
    On Error Resume Next
    
'Reference the current Outlook item
    Set objItem = Application.ActiveInspector.CurrentItem
    If Not objItem Is Nothing Then
        If objItem.Class = olMail Then
            Set objInsp = objItem.GetInspector
            If objInsp.EditorType = olEditorWord Then
                Set objDoc = objInsp.WordEditor
                Set objWord = objDoc.Application
                Set objSel = objWord.Selection
 
 
' replace the With block with your code
        With objSel
        ' Formatting code goes here
            .Font.Color = wdColorAutomatic
            .Font.Size = 14
            .Font.Bold = False
            .Font.Italic = False
            .Font.Name = "Calibri"
        End With
        With objSel.ParagraphFormat
            .SpaceAfter = 8
            .LineSpacingRule = wdLineSpaceExactly 
            .LineSpacing = 18.5
        End With
            End If
        End If
    End If
     
    Set objItem = Nothing
    Set objWord = Nothing
    Set objSel = Nothing
    Set objInsp = Nothing
End Sub

I've made this a button on the new message Quick Access Toolbar that looks like this:
. To do this, create a new message and go to File>Options>Quick Access Toolbar and choose Macros from the Choose commands from drop-down menu. Click on your macro, click Add, and then highlight it in the right column and click Modify.

No comments:

Post a Comment