• Subject: Outlook macro - new email - how to set font
  • Author: Mark
  • Date: 15 Jun 2010
  • References:
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)