1

I have to following issue: With Outlook 2010 - or Outlook in general - when you reply on a email with HTML format, then some formatting is used from the received email.

Often the paragraph settings are different from my template. I found a simple way to change the formatting to my standard settings:

In the open email, on the ribbon choose:
Tab "Format Text", click on "Change Styles" on the right, choose "Style Set", select "Word 2003"

Now I would like to create a macro that does that task automatically when I select "reply", "reply all" or "forward".

Unfortunately Outlook does not have a macro recorder :( I found something similar but there is no response at all: Outlook 2007: Reply and Forward Fails to Use Default Formatting
Or this macro here does not work: http://www.codetwo.com/admins-blog/set-email-reply-format-automatically/

What would be the macro code to do the above steps in the GUI?

mrdude
  • 13
  • 2

1 Answers1

2

You can just apply the required style set and then select Set as Default in the bottom of Change Styles menu.

Or you can do something like this:

Public WithEvents OutlookInspectors As Outlook.Inspectors
Public WithEvents OutlookInspector As Outlook.Inspector

Private Sub Application_Startup()
    Set OutlookInspectors = Application.Inspectors
End Sub

Private Sub OutlookInspectors_NewInspector(ByVal Inspector As Inspector)
    Set OutlookInspector = Inspector
End Sub

Private Sub OutlookInspector_Activate()
    On Error Resume Next
    Dim Item As MailItem

    If Not OutlookInspector Is Nothing Then
        Set Item = OutlookInspector.CurrentItem
        If Not Item Is Nothing And Item.Size = 0 Then
            OutlookInspector.WordEditor.ApplyQuickStyleSet "Word 2003"
        End If
    End If

    Set OutlookInspector = Nothing
End Sub
thims
  • 9,127
  • 26
  • 36
  • Thank you for that idea but I have already tried that without success. The default setting does not work for all emails I reply to. – mrdude Jul 15 '15 at 11:04
  • Updated the answer by including VBA macro – thims Jul 15 '15 at 12:33
  • THIS WORKS, just make sure you enable macros for Outlook first: https://www.extendoffice.com/documents/outlook/1368-outlook-enable-disable-macros.html –  Jul 09 '19 at 13:15
  • Could you see the following question, which may have a very similar answer? https://superuser.com/questions/1504009/different-default-style-set-for-new-emails-and-to-notes-in-new-contacts-appoint The first two lines of code give are marked in red as errors in the BVA editor. – Rodolfo Oviedo Nov 21 '19 at 16:16