Solved

Editing an Outlook Macro to Reply

Posted on 2014-03-07
2
326 Views
Last Modified: 2014-03-17
I have an outlook macro that creates a new email based on a selected message. I am wanting it to create a reply instead of a new message. I am mainly wanting this so that the original email is viewable. Can this be done?

Sub MailItemContent()

    Dim OutApp As Outlook.Application
    Dim OutMail As Outlook.MailItem
    Dim sText As String

    Set olItem = ActiveExplorer.Selection.Item(1)
    sText = olItem.Body
    Lines = Split(sText, vbCrLf)
    
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(olMailItem)

    On Error Resume Next
    With OutMail
        .To = Replace(Lines(4), "Opened By: ", "")
        .Subject = Lines(3)
        .Body = ""
        .SendUsingAccount = OutApp.Session.Accounts.Item(1)

        .Display
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub

Open in new window

0
Comment
Question by:Joseph Moody
2 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
Comment Utility
Hi,

It sure can be done. When you create the message, use this instead:
'    Set OutMail = OutApp.CreateItem(olMailItem)
    Set OutMail = olItem.Reply

Open in new window

You'll likely want to remove the     .body=""      line later though.

Matt
0
 
LVL 21

Author Closing Comment

by:Joseph Moody
Comment Utility
Thank you!
0

Featured Post

Do email signature updates give you a headache?

Constantly trying to correctly format email signatures? Spending all of your time at every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…

743 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

12 Experts available now in Live!

Get 1:1 Help Now