Results 1 to 3 of 3

Thread: I need a simple VBA script to automatic reply certain messages

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    2

    I need a simple VBA script to automatic reply certain messages

    Hello,

    I am new to VB and I´ve been trying to code a script that will perform a simple task. I need this script to run automatically in Microsoft Outlook 2003 and do the following:
    1 - Once started, the script will reply to a specific message
    2 - Insert before the original text the following text:
    " Hello <e-mail address from sender>. Thanks for your e-mail sent at <current time or time the email was received> with the subject <e-mail subject>. I will get back to you as soon as possible.
    3 - Send the e-mail with the above text and the original text

    I can creat inbox rules to run the script, but I lack programing experience so I can start coding what I need. If anybody has done this before or can show me a code that does this, or code similar that I can try to alter, I would greatly appreciate it.

    Fred Pohl

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    2

    Re: I need a simple VBA script to automatic reply certain messages

    This is what I got so far.
    Now all I need are two things
    1 - Instead of starting a new e-mail, I want to REPLY to a specific email.
    So I guess I have to change sometinhg in the Set msg = ApplicationCreateItem(olMailItem),

    2 - Set some variables with the sender´s address, current time and subject so I can replace them in the message body.

    Sub HelloWorldTeste()
    Dim msg As Outlook.MailItem
    Dim oEmail As Object
    Set msg = Application.CreateItem(olMailItem)
    Set objApp = Application
    msg.Subject = "Hello World!"
    msg.Body = "Hello <sender>. I received your e-mail at <current time> with the subject <subject>. I will return to you as soon as possible"
    msg.Display
    Set msg = Nothing
    End Sub

  3. #3
    Addicted Member Smartacus's Avatar
    Join Date
    Oct 2009
    Location
    Deep South, USA
    Posts
    196

    Re: I need a simple VBA script to automatic reply certain messages

    You can find more help here:
    http://office.microsoft.com/en-us/ou...223851033.aspx

    Create a rule to automatically reply to new e-mail messages

    1. On the Tools menu, click Rules and Alerts.
    2. In the Rules and Alerts dialog box, click New Rule.
    3. Click Start from a blank rule, click Check messages when they arrive, and then click Next.
    4. Under Which condition(s) do you want to check?, select the Sent Only To Me check box and any other criteria that you want, and then click Next.
    5. Under What do you want to do with the message?, select the Reply using a specific template check box.
    6. Under Step 2: Edit the rule description (click an underlined value), click a specific template.
    7. In the Select a Reply Template dialog box, in the Look In box, click User Templates in File System. Select the template that you created in the previous section, and then click Open.
    8. Click Next.
    9. Optionally, select the check boxes for any exceptions to the auto-reply rule.
    10. Click Next.
    11. Under Step 1: Specify a name for this rule, type a name for the auto-reply rule, and then click Finish.
    ***************************************************
    Smartacus comes packaged "As Is With No Warranty"

    ************* Useful Links ******************
    FAQs: Index / Database Development / .NET CodeBank /
    Before Posting Here...MSDN

    MZTools (I love this tool when using VB6 - Free) /

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width