Outlook VBA

Farback

Board Regular
Joined
Mar 27, 2009
Messages
149
Does anyone know the VBA code for replying to an e-mail, using standard text.
[FONT=Arial,Verdana]I get a lot of e-mails which I need to respond to with "your e-mail has been received..." etc. What I would like is a button to click that will generate the return e-mail, using the sender's 'From' address, inserting the standard text message, but not actually sending the message until it has been checked and the text personalised. I don't want to set this up as a'Rule' because not all e-mails will require this response. Ideally, I need to read the e-mail, decide if it needs a standard reply, click a button to generate the response, change a bit of the text, then click 'Send'. Any help appreciated[/FONT]
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Something like this:
Code:
Sub ReplyMessage()
   Dim itmMail As MailItem
   On Error Resume Next
   Set itmMail = Application.ActiveExplorer.Selection.Item(1)
   On Error GoTo 0
   If Not itmMail Is Nothing Then
      Set itmMail = itmMail.Reply
      With itmMail
         .Body = "Your email has been received. Ta very much" & .Body
         .Display
      End With
   End If
         
End Sub
 
Upvote 0
Thanks Rorya, that works fine. Just one thing, my message tends to be a bit long, how do I put a line return into the code to input a second paragraph
 
Upvote 0
You need to add vbcrlf wherever you want a new line:
Code:
strmsg = "some text" & vbcrlf & "another line"
for example.
 
Upvote 0

Forum statistics

Threads
1,224,504
Messages
6,179,144
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top