• Subject: Re: Outlook macro - new email - how to set font
  • Author: Ken Slovak
  • Date: 16 Jun 2010
  • References: 1
If the format of the email is HTML you will need to use HTML coding and tags
for the font settings, using HTMLBody and not Body.

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

"Mark" <mark.ok7@gmail.com> wrote in message
news:125c6904-f93d-4599-aed1-50e237b6f8fd@y18g2000prn.googlegroups.com...
> Hi
>
> A while since I worked on this.
>
> From previous threads I've created a macro that I click and it replies
> to an email with "Dear John" or whatever using the code (in part)
>
> NewMsg.Body = "Dear " & Left$(myItem.SenderName, InStr(1,
> myItem.SenderName, " ") - 1) _
> & "," & vbCr & vbCr & vbCr
>
> Trouble is the font is different in my new email when I hit enter
> after "Dear John"
>
> How do I set the font here?
>
> Mark
>
> BTW the full code is:
>
> Sub Dear_Name()
> Dim myItem As Outlook.MailItem
> Dim NewMsg As Outlook.MailItem
>
> ' get valid ref to current item
> On Error Resume Next
> Select Case TypeName(Application.ActiveWindow)
> Case "Explorer"
> Set myItem = ActiveExplorer.Selection.Item(1)
> myItem.Display
> Case "Inspector"
> Set myItem = ActiveInspector.CurrentItem
> Case Else
> End Select
> On Error GoTo 0
>
> If myItem Is Nothing Then
> MsgBox "Could not use current item. Please select or open a
> single email.", _
> vbInformation
> GoTo ExitProc
> End If
>
> Set NewMsg = myItem.Reply
>
> NewMsg.Body = "Dear " & Left$(myItem.SenderName, InStr(1,
> myItem.SenderName, " ") - 1) _
> & "," & vbCr & vbCr & vbCr & "Regards, ..." & vbCr & vbCr &
> "_____________________________________________" _
> & vbCr & "From: " & (myItem.SenderName) & vbCr & "Sent: " &
> (myItem.SentOn) & vbCr & "To: " & (myItem.To) & vbCr & "Subject: " &
> (myItem.Subject) & vbCr & vbCr & myItem.Body
> myItem.Close olDiscard
> NewMsg.Display
>
> 'Edit "Regards, ..." to whatever you want
>
> ExitProc:
> Set myItem = Nothing
> Set NewMsg = Nothing
> End Sub
15 Jun 2010Outlook macro - new email - how to set font.Mark
16 Jun 2010\ Re: Outlook macro - new email - how to set font.Ken Slovak
16 Jun 2010   \ Re: Outlook macro - new email - how to set font.Mark
17 Jun 2010      \ Re: Outlook macro - new email - how to set font.Ken Slovak
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)