New Rule

%3CLINGO-SUB%20id%3D%22lingo-sub-1446942%22%20slang%3D%22en-US%22%3ENew%20Rule%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1446942%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20trying%20to%20setup%20a%20rule%20to%20reply%20when%20certain%20text%20appears%20in%20subject%20and%20body.%20I%20have%20set%20this%20up%20but%20I%20need%20outlook%20to%20include%20the%20original%20message%20in%20the%20text.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20copied%20some%20VBA%20codes%2C%20enabled%20use%20a%20script%20in%20rules%20but%20either%20I%20can't%20see%20any%20macros%20and%20if%20I%20can%20they%20don't%20seem%20to%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20given%20up%20banging%20my%20head%20against%20the%20wall%20-%20this%20is%20what%20I%20need%20-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eif%20(specfic%20text)%20appears%20in%20subject%20or%20body%20reply%20with%20(message)%20and%20include%20the%20original%20text%20using%20a%20script%20or%20macro.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20reply%20must%20contain%20the%20original%20email%20otherwise%20it%20is%20worthless.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20can%20someone%20help%20me.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EPublic%20WithEvents%20olItems%20As%20Outlook.Items%0A%0APrivate%20Sub%20Application_Startup()%0A%20%20%20%20Set%20olItems%20%3D%20Session.GetDefaultFolder(olFolderInbox).Items%0AEnd%20Sub%0A%0APrivate%20Sub%20olItems_ItemAdd(ByVal%20Item%20As%20Object)%0A%20%20%20%20Dim%20olReply%20As%20MailItem%0A%20%0A%20%20%20%20If%20Item.Class%20%3D%20olMail%20Then%0A%20%20%20%20%20%20%20Set%20olReply%20%3D%20Item.Reply%0A%20%20%20%20Else%0A%20%20%20%20%20%20%20Exit%20Sub%0A%20%20%20%20End%20If%0A%20%0A%20%20%20%20With%20olReply%0A%20%20%20%20%20%20%20%20%20'Type%20Your%20Own%20Auto%20Reply%0A%20%20%20%20%20%20%20%20%20'Change%20%22John%20Smith%22%20to%20Your%20Own%20Name%0A%20%20%20%20%20%20%20%20%20.Body%20%3D%20%22This%20is%20a%20test%20auto%20reply.%22%20%26amp%3B%20vbCrLf%20%26amp%3B%20vbCrLf%20%26amp%3B%20%22-------Original%20Message-------%22%20%26amp%3B%20vbCrLf%20%26amp%3B%20%22From%3A%20%22%20%26amp%3B%20Item.Sender%20%26amp%3B%20%22%5Bmailto%3A%20%22%20%26amp%3B%20Item.SenderEmailAddress%20%26amp%3B%20%22%5D%22%20%26amp%3B%20vbCrLf%20%26amp%3B%20%22Sent%3A%20%22%20%26amp%3B%20Item.ReceivedTime%20%26amp%3B%20vbCrLf%20%26amp%3B%20%22To%3A%20YourName%22%20%26amp%3B%20vbCrLf%20%26amp%3B%20%22Subject%3A%20%22%20%26amp%3B%20Item.Subject%20%26amp%3B%20vbCrLf%20%26amp%3B%20Item.Body%0A%20%20%20%20%20%20%20%20%20.Send%0A%20%20%20%20End%20With%0AEnd%20Sub%3C%2FPRE%3E%3CP%3EThis%20is%20what%20I%20used%2C%20it%20didn't%20work%20but%20was%20still%20in%20VB%20with%20no%20errors.%20I%20couldn't%20find%20it%20in%20scripts%2C%20macros%20or%20anywhere%20so%20I%20copied%20another%20script%20to%20save%20the%20macro%20but%20that%20didn't%20work%20either.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22kwd%22%3ESub%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20myRuleMacro%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Eitem%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22kwd%22%3Eas%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20Outlook%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EMailItem%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E)%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EI%20don't%20know%20whether%20this%20should%20be%20separate%20script%20or%20included%20in%20the%20first%20text%20%3F%3F%20This%20second%20script%20appeared%20in%20Rules%20and%20allowed%20me%20to%20select%20but%20didn't%20do%20anything%20else.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E
Regular Visitor

Hi

 

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
    Else
       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
         .Send
    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.

 

Regards

0 Replies