Link to home
Start Free TrialLog in
Avatar of Joseph Moody
Joseph MoodyFlag for United States of America

asked on

Editing an Outlook Macro to Reply

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

ASKER CERTIFIED SOLUTION
Avatar of mvidas
mvidas
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Joseph Moody

ASKER

Thank you!