Solved

Editing an Outlook Macro to Reply

Posted on 2014-03-07
2
333 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
To show how to generate a certificate request 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 >> Certificates…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

728 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