• Subject: Macro & buttons to reply Dear - new idea (Outlook 7)
  • Author: Mark
  • Date: 13 Dec 2010
  • References:
I wish to develop my idea further and need help - I've been playing with it but I'm not an expert Presently I fire up the below macro when I have an email highlighted and it enters the "Dear Joe" etc in the email body. I'm wondering if it would be possible to apply this slightly differently. To start an email i.e. new or click reply, ensure that there is a recipient in the 'To' box, e.g. to "Joe", then click the macro to complete the email with "Dear Joe Regards Mark" (Thanks again to members of this discussion board for help in creating the below macro.) Cheers Mark 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 With NewMsg NewMsg.BodyFormat = olFormatHTML .HTMLBody = "<span style=""font-size:11.0pt;font-family: Calibri (Body);color:#1F497D""><p>Regards, Mark <br /> " & vbCr & vbCr & vbCr & vbCr & "</p>" & .HTMLBody .HTMLBody = "<span style=""font-size:11.0pt;font-family: Calibri (Body);color:#1F497D""><p> <br />" & "</p>" & .HTMLBody .HTMLBody = "<span style=""font-family : Calibri (Body);font-size : 11pt;color:#1F497D""><p>Dear " & Left$(myItem.SenderName, InStr(1, myItem.SenderName, " ") - 1) & ",</p></span>" & .HTMLBody End With myItem.Close olDiscard NewMsg.Display ExitProc: Set myItem = Nothing Set NewMsg = Nothing End Sub
13 Dec 2010Macro & buttons to reply Dear - new idea (Outlook 7).Mark
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)