New Rule

Copper Contributor



I'm trying to setup a rule to reply when certain text appears in subject and body. I have set this up but I need outlook to include the original message in the text.


I have copied some VBA codes, enabled use a script in rules but either I can't see any macros and if I can they don't seem to work.


I have given up banging my head against the wall - this is what I need -


if (specfic text) appears in subject or body reply with (message) and include the original text using a script or macro.


The reply must contain the original email otherwise it is worthless.


Please can someone help me.


Public WithEvents olItems As Outlook.Items

Private Sub Application_Startup()
    Set olItems = Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub olItems_ItemAdd(ByVal Item As Object)
    Dim olReply As MailItem
    If Item.Class = olMail Then
       Set olReply = Item.Reply
       Exit Sub
    End If
    With olReply
         'Type Your Own Auto Reply
         'Change "John Smith" to Your Own Name
         .Body = "This is a test auto reply." & vbCrLf & vbCrLf & "-------Original Message-------" & vbCrLf & "From: " & Item.Sender & "[mailto: " & Item.SenderEmailAddress & "]" & vbCrLf & "Sent: " & Item.ReceivedTime & vbCrLf & "To: YourName" & vbCrLf & "Subject: " & Item.Subject & vbCrLf & Item.Body
    End With
End Sub

This is what I used, it didn't work but was still in VB with no errors. I couldn't find it in scripts, macros or anywhere so I copied another script to save the macro but that didn't work either.


Sub myRuleMacro(item as Outlook.MailItem)

I don't know whether this should be separate script or included in the first text ?? This second script appeared in Rules and allowed me to select but didn't do anything else.



0 Replies