Solved

Keep default Font in Macro for replies in HTML to Plain Text emails

Posted on 2010-09-01
5
946 Views
Last Modified: 2012-05-10
Hi there,
I'm using this piece of code I got from http://outlook-tips.net/cs/blogs/outlooktips/archive/2007/08/02/671.aspx

_____________________________

Option Explicit

Private WithEvents oExpl As Explorer
Private WithEvents oItem As MailItem

Private bDiscardEvents As Boolean
Private olFormat As OlBodyFormat


Private Sub Application_Startup()
   
   Set oExpl = Application.ActiveExplorer
   
   bDiscardEvents = False
   olFormat = olFormatHTML
End Sub

Private Sub oExpl_SelectionChange()

   On Error Resume Next
   Set oItem = oExpl.Selection.Item(1)
   
End Sub
Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean)

   If bDiscardEvents Or oItem.BodyFormat = olFormat Then
       Exit Sub
   End If
   
  Cancel = True

  bDiscardEvents = True
  Dim oResponse As MailItem
  Set oResponse = oItem.Reply
  oResponse.Display
  oResponse.BodyFormat = olFormat
   
 bDiscardEvents = False
   
End Sub
Private Sub oItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)

   If bDiscardEvents Or oItem.BodyFormat = olFormat Then
       Exit Sub
   End If

   Cancel = True
 
   bDiscardEvents = True
   
   Dim oResponse As MailItem
   Set oResponse = oItem.ReplyAll
   oResponse.Display
   oResponse.BodyFormat = olFormat
   
   bDiscardEvents = False
   
End Sub
Private Sub oItem_Forward(ByVal Forward As Object, Cancel As Boolean)
   
   If bDiscardEvents Or oItem.BodyFormat = olFormat Then
       Exit Sub
   End If
   
   Cancel = True

   bDiscardEvents = True
   
   Dim oResponse As MailItem
   Set oResponse = oItem.Forward
   oResponse.Display
   oResponse.BodyFormat = olFormat
   
   bDiscardEvents = False
   
End Sub

____________________________

that converts  to html when you reply to a plain text message. It works good, but I have an issue with the fonts, I have all my fonts set to Calibri, and a signature, and it always changes to Time new roman.  Now it does change the font even when I reply to HTML emails
Could anyone advice me how to change this code to keep my default font selection whenever I reply to a message?

Thanks for your time!
Andres Iniesta.
0
Comment
Question by:japinrem
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:peakpeak
Comment Utility
0
 

Author Comment

by:japinrem
Comment Utility
@peakpeak
Yes, I do have all that configurations set up in my account, If I don´t use the macro code above my emails use the fonts I have configured, but when I reply to a plain text message, this is made in plain text as well.
To change that behaviour I tried the macro, and It works generating a reply in HTML format, but changing at the same time my fonts to Time New Roman.

So, maybe this can't be changed inside the macro, at least my VBA skills aren´t good enough to do it.
0
 
LVL 28

Accepted Solution

by:
peakpeak earned 500 total points
Comment Utility
If you choose HTML format for the replies you can always put
<div><style="font-family:Calibri;"> .... (your text) ... </div>
as the body in the message
0
 

Author Comment

by:japinrem
Comment Utility
I'm sorry, I don't follow you, where do I use that piece of HTML? Sorry.
0
 
LVL 28

Expert Comment

by:peakpeak
Comment Utility
As the text
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now