Solved

VBA Code

Posted on 2006-07-18
7
326 Views
Last Modified: 2006-11-18
Hi,

We are currently working on stream lining alot of our relative tasks and one of them is sending a standard reply to emails that come into our mail boxes via a macro.

We want the macro to reply to the sender with a new subject line, and a standard message body that we can define with in the macro.

Currently we have it working on forwarding but we are unable to get it working on the reply with a set body text.

Does anyone have any ideas as to how we can do this?

We are using Outlook 2000 and the macro editor with in it.

thanks david jacques

0
Comment
Question by:cmrecruitment
  • 3
7 Comments
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Hi cmrecruitment,

Are you forwarding with a macro?  If so, then post the code I can show you how to modify it to send a reply.  

Cheers!
0
 
LVL 2

Expert Comment

by:masoncooper
Comment Utility
If you are trying to reply with a semi-custom message, you may want to try setting up a rule that replies using a template, I'm not sure what all you want your macro to do, but if it's just a bit of customization, this is the way to go.

Tools > Rules and Alerts > New Rule
Construct the rule to run based on your own criteria, but when you select an Action, choose "Reply using a specific template".  This allows you to choose a template that you can create that has fields to further customize the message beyond boilerplate text.
0
 

Author Comment

by:cmrecruitment
Comment Utility
Hi bluedevilfan,

here is our current code. It just a forwarding macro at the moment.

thanks david jacques

Sub explorerNames()
 
Dim myOlApp As New Outlook.Application
    Dim myOlExp As Outlook.Explorer
    Dim myOlSel As Outlook.Selection
    Dim MsgTxt As String
   
    Dim x As Integer
    Dim myNms As Outlook.NameSpace
    Dim myFolder As Outlook.MAPIFolder
    Dim myRecipient As Outlook.Recipient
    Dim myItem As MailItem
    MsgTxt = "You have selected items from: "
   
    Set myOlExp = myOlApp.ActiveExplorer
    Set myOlSel = myOlExp.Selection
    Set myItem = myOlSel.Item(1)
    For x = 1 To myOlSel.Count
              MsgTxt = myItem.SenderName
        Set myForward = myItem.Forward
        myForward.To = "davidj@candm.co.uk"
        myForward.Send
    Next x
End Sub
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
Comment Utility
Ok, here's your code modified to send a reply.  I also took the liberty of cleaning it up a bit.  Hope you don't mind.

Sub explorerNames()
    Dim MsgTxt As String, _
        myItem As MailItem, _
        myReply As MailItem
    MsgTxt = "You have selected items from: "
    For Each myItem In Application.ActiveExplorer.Selection
        MsgTxt = myItem.SenderName
        Set myReply = myItem.Reply
        'Use HTMLBody instead of Body on the next line if your messages are in HTML format
        myReply.Body = MsgTxt
        myReply.Send
    Next
End Sub
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Any update, cmrecruitment?
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
Outlook Free & Paid Tools
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now