Reply to Outlook messages by moving messages to a specific Outlook folder

Outlook version
Outlook 2019 64-bit
Email Account
Outlook.com (as MS Exchange)
Dear Diana, partners:

With the pleasure of greeting you, I have the following problem that I would be very grateful for if you could help me solve it.

In fact, I already checked this same page so as not to repeat something that may already have an answer and I found a similar topic;

<Auto forward email that is moves into a specific outlook folder>

But since it has certain differences I dare to explain my situation. Thanks in advance.

Although I have some knowledge of VBA, I am practically new to Outlook VBA, so I require your invaluable help to resolve the following:

The following code, being from an itemadd macro, was placed in "ThisOutlookSession"



Option Explicit

'// items in the target folder to events

Dim WithEvents TargetFolderItems As Items


Private Sub Application_Startup()

Dim olNamespace As Outlook.NameSpace



Set olNamespace = Application.GetNamespace("MAPI")

'// Set your folder here

Set TargetFolderItems = olNamespace.GetDefaultFolder(olFolderInbox) _

.Folders.Item("REPLY").Items

End Sub



'// ItemAdd event code

Sub TargetFolderItems_ItemAdd(ByVal Item As Object)

Dim olReply As MailItem



'Email Body Text

Dim xOutMsg As String

'Define the final text of the email body

Dim emReplyFinal As String

Dim CustName As String

'Email body text goes here

emReplyFinal = "<HTML><BODY> <div style=""text-align:justify""><span style='font-family: ""Montserrat"" '><span style='font-size:10.5pt'>" & _

" <p>LONG text LONG text LONG text LONG text LONG text LONG text LONG text " & _

" <b> Document name in the referenced link</b> " & _

"<a href=""Hyperlink to document"">" & _

" LONG text LONG text LONG text LONG text LONG text LONG text LONG text LONG""</a><br><br>" & _

"Greetings.</a>" & _

"<p></font></font> </BODY></HTML>"



Set olReply = Item.Reply

CustName = olReply.To

xOutMsg = "<p style='font-family:Montserrat;FontStyle:Normal;font-size:10.5pt'>" & _

"Apreciable " & CustName & ":" & emReplyFinal

olReply.HTMLBody = xOutMsg & vbCrLf & olReply.HTMLBody

olReply.Send

Set TargetFolderItems = Nothing

Set olReply = Nothing

End Sub


The thing is that, when you enter the code in Outlook, and verify that it works, it does, but only with a single message that is moved to the “REPLY” folder of Outlook and, furthermore, it is not constant since I have to close the application to get it used and working again.

I require it to work without closing and opening Outlook for use and that it also work with multiple messages that I move to said “REPLY” folder. Excuse my poor English, but broadly speaking that is my problem.

I do not omit to tell you that I am a newbie to Outlook macros and it has been a bit complicated for me to understand the process, but I have already searched and searched for a way to adapt it for the use I require, only there is no solution.

Waiting for your valuable help. Thanks for the attention.
 
Dear Diana, partners:

With the pleasure of greeting you, I have the following problem that I would be very grateful for if you could help me solve it.

In fact, I already checked this same page so as not to repeat something that may already have an answer and I found a similar topic;

<Auto forward email that is moves into a specific outlook folder>

But since it has certain differences I dare to explain my situation. Thanks in advance.

Although I have some knowledge of VBA, I am practically new to Outlook VBA, so I require your invaluable help to resolve the following:

The following code, being from an itemadd macro, was placed in "ThisOutlookSession"



Option Explicit

'// items in the target folder to events

Dim WithEvents TargetFolderItems As Items


Private Sub Application_Startup()

Dim olNamespace As Outlook.NameSpace



Set olNamespace = Application.GetNamespace("MAPI")

'// Set your folder here

Set TargetFolderItems = olNamespace.GetDefaultFolder(olFolderInbox) _

.Folders.Item("REPLY").Items

End Sub



'// ItemAdd event code

Sub TargetFolderItems_ItemAdd(ByVal Item As Object)

Dim olReply As MailItem



'Email Body Text

Dim xOutMsg As String

'Define the final text of the email body

Dim emReplyFinal As String

Dim CustName As String

'Email body text goes here

emReplyFinal = "<HTML><BODY> <div style=""text-align:justify""><span style='font-family: ""Montserrat"" '><span style='font-size:10.5pt'>" & _

" <p>LONG text LONG text LONG text LONG text LONG text LONG text LONG text " & _

" <b> Document name in the referenced link</b> " & _

"<a href=""Hyperlink to document"">" & _

" LONG text LONG text LONG text LONG text LONG text LONG text LONG text LONG""</a><br><br>" & _

"Greetings.</a>" & _

"<p></font></font> </BODY></HTML>"



Set olReply = Item.Reply

CustName = olReply.To

xOutMsg = "<p style='font-family:Montserrat;FontStyle:Normal;font-size:10.5pt'>" & _

"Apreciable " & CustName & ":" & emReplyFinal

olReply.HTMLBody = xOutMsg & vbCrLf & olReply.HTMLBody

olReply.Send

Set TargetFolderItems = Nothing

Set olReply = Nothing

End Sub


The thing is that, when you enter the code in Outlook, and verify that it works, it does, but only with a single message that is moved to the “REPLY” folder of Outlook and, furthermore, it is not constant since I have to close the application to get it used and working again.

I require it to work without closing and opening Outlook for use and that it also work with multiple messages that I move to said “REPLY” folder. Excuse my poor English, but broadly speaking that is my problem.

I do not omit to tell you that I am a newbie to Outlook macros and it has been a bit complicated for me to understand the process, but I have already searched and searched for a way to adapt it for the use I require, only there is no solution.

Waiting for your valuable help. Thanks for the attention.
 
Similar threads
Thread starter Title Forum Replies Date
P Automatic reply on incoming messages in outlook using VBA(only Specifi person) Using Outlook 14
Y Outlook 2010 Select and reply to multiple messages at one time Using Outlook 0
Y Outlook 2010 Select and reply to multiple messages at one time Using Outlook 2
G Reply a selected message and remove blank space before signature Outlook 365 version 2406 64BIT Outlook VBA and Custom Forms 2
G Reply a selected message and remove blank space before signature Outlook 365 version 2406 64BIT Outlook VBA and Custom Forms 0
T In-line reply style in Outlook II Outlook VBA and Custom Forms 1
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
ThinkToday Calculate reply time of outlook mail Using Outlook 1
J Outlook Reply > From > Other Email Address... > Address Not Showing in Sent Items... From Email Outlook VBA and Custom Forms 0
M Reply Inline With a Outlook Template Outlook VBA and Custom Forms 6
A VB to "reply all" email items stored in a folder of outlook with adding a new message Outlook VBA and Custom Forms 0
K Extract email address from body and auto-reply outlook Using Outlook 1
T In-line reply style in Outlook Outlook VBA and Custom Forms 20
G Outlook 2016: reply icon not showing when replied from mobile Using Outlook 3
C Outlook Attachment List in Reply Header Using Outlook 3
D Reply Problem with Outlook.com account Using Outlook.com accounts in Outlook 0
Diane Poremsky Outlook Crashes When You Reply or Create a New Message Using Outlook 0
S Outlook Macro Reply to a message Outlook VBA and Custom Forms 1
M VBA Auto-Reply code for Two Mailboxes on one Outlook Session. Outlook VBA and Custom Forms 4
M Reply all intercept Outlook 2010 Outlook VBA and Custom Forms 5
M Automatically move Outlook message to the specific folder when click on reply to all Using Outlook 4
1Firefly Outlook 2013 Converstation preview does not show my last reply Exchange Server Administration 1
S Macro for Reply All in 2013 Outlook Outlook VBA and Custom Forms 10
L Outlook 2007 Macro Reply to E-mail Using Outlook 16
Hudas MS Outlook VBA: Get the reply date and time. Outlook VBA and Custom Forms 9
E Outlook reply to Gmail prints gobbledygook Using Outlook 3
S Outlook 2013 - Customized auto-reply message Using Outlook 10
R Reply all in Outlook 2010 not working Using Outlook 3
P Outlook 2010 Font on Reply Email is Very Small Ruler Will Not Extend Using Outlook 2
P Reply All does not work in Outlook 2010 Cached mode Using Outlook 4
A Macro in Outlook for auto-reply Using Outlook 3
S Outlook 2k/2k3 Reply or Forward: Signature image replaced by original sender Using Outlook 3
A Outlook 2010 - Want to Have All Email Reply Forward as Rich Test Using Outlook 7
M Move 'Reply All' on Ribbon in Outlook 2010 Using Outlook 2
S Outlook 2003 Prefix on reply and forward Using Outlook 1
K reply to all the mail in a specific outlook folder Using Outlook 1
S Outlook 2003: Help with setting up a macro to reply to selected emails Using Outlook 2
C Text reply mail in Outlook 2010 has automatic margin indent Using Outlook 9
B Reply to All custom action doesn't work with attachments in Outlook 2007 Using Outlook 1
M outlook Reply TimeStamp Outlook VBA and Custom Forms 1
M Auto-reply with macro whether logged in to outlook or not Outlook VBA and Custom Forms 2
R Outlook-Changing default reply format to HTML Outlook VBA and Custom Forms 5
G Outlook 2003 - automatically deleting inbox msg after reply Outlook VBA and Custom Forms 1
S Choosing different reply template in Outlook 2000 Outlook VBA and Custom Forms 1
M Simple Reply, Reply All, Forward Outlook VBA and Custom Forms 1
J Macro to Reply to Emails w/ Template Outlook VBA and Custom Forms 3
J Quick steps delete original email and move reply/sent email to folder Using Outlook 2
nmanikrishnan Auto-reply from default account Using Outlook 1
P Automatic Greeting "Hello Name," when Reply All is clicked Outlook VBA and Custom Forms 1
N Line to move origEmail to subfolder within a reply macro Outlook VBA and Custom Forms 0

Similar threads

Back
Top