Create a rule in vba for Outlook that reply with templates RRS feed

  • Question

  • Hi everybody !

    I would like to create a rule in a vba script that reply with a template.

    Here is my code : 

    Dim appOutlook As Outlook.Application
    Dim olRules As Outlook.Rules
    Dim myRule As Outlook.Rule
    Dim moveToAction As Outlook.MoveOrCopyRuleAction
    Dim Repondre As Outlook.SendRuleAction
    Dim fromAction As Outlook.ToOrFromRuleCondition
    Dim myInbox As Outlook.Folder
    Dim moveToFolder As Outlook.Folder
    Dim moveToFolderDest As Outlook.MAPIFolder

    Set appOutlook = New Outlook.Application
    Set myInbox = appOutlook.Session.GetDefaultFolder(olFolderInbox)
    Set olRules = appOutlook.Session.DefaultStore.GetRules()
    Set myRule = olRules.Create("My Test Rule", olRuleReceive)

    Set fromAction = myRule.Conditions.SentTo
    With fromAction
    .Enabled = True
    .Recipients.Add ("ExampleMail")
    End With

    Set Repondre = myRule.Actions.?REPLYWITHTEMPLATE?

    ?With Repondre.Template ("C:\Template.oft")?
    Repondre.Enabled = True
    End With


    My problem is in BOLD, i don't know what to do to create my rule with an eventually "reply with template" action !

    Anyone have an idea ? Thank you & have a nice day.

    Julien From FRANCE

    • Déplacé Aurel Bera lundi 30 juin 2014 14:06 VBA
    jeudi 26 juin 2014 09:54