Replying to an email using VBA

Hi

Am trying to feel my way through an outlook vba project

I am trying to manage prospect customer enquries, by appending an ID to the subjet before sending (there is more of a rationale to it, but i wont bore you)

So what i want to be able to do, is select an email, but rather than click Reply or Forward, i want to click a button which opens a form (which i can do) but then i want to be able to select the company that it applies to, and then tell it to reply or forward, and it will do that to the selected email.

At the moment, i can only select the first, next, last email etc through vba, but it needs to be the selected one as it could be anywhere in the persons inbox

thanks
Grant SurridgeIT ControllerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Greetings, seancurt.

If I'm understanding correctly you want to know if there's a means of performing an operation on a group of selected messages.  Assuming that's right, then here's how to go about doing it.

    Dim objSelectedItems As Outlook.Selection, _
        objItem as Outlook.MailItem
    'This will capture all the selected items in the current explorer
    Set objSelectedItems = Application.ActiveExplorer.Selection
    For Each objItem In objSelectedItems
        'Insert code here for whatever you want to do with each selected item
    Next

Cheers!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.