?
Solved

Editing an Outlook Macro to Reply

Posted on 2014-03-07
2
Medium Priority
?
334 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 2000 total points
ID: 39912703
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 22

Author Closing Comment

by:Joseph Moody
ID: 39934186
Thank you!
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

741 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