Run a VB macro on text selected in the outlook preview pane


I want to write a vb macro that creates a new email from text i have selected in the preview pane (olPreview i think) however I am pretty new to outlook. How can I co about getting the selected text into a string so that i can then generate a new email from this text (I have generated emails before).

Any advice or pointers would be great.


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.

hallzAuthor Commented:
Note: I think it is actually called the 'Reading Pane' - the thing i need data from is the reading pane which sits under your list of emails in outlook.
David LeeCommented:
Hi hallz,

I know of no way to get the selected text from the Reading pane.  If you want to get the selected text from the current message window and are willing to use Redemption, then this will do the trick:


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
hallzAuthor Commented:
The closest thing I have found is this

There is probably some way to access the selection higher up somewhere in the api's, but this will be sufficient for my project.

Thanks for posting.
David LeeCommented:

The material in that link isn't even close to what you indicated you were looking for.  That code is for getting the currently selected item (e.g. message, contact, appointment, etc.) in a list of items.  It has nothing at all to do with returning text selected in the reading pane or the body of the message.  Did I misunderstand what you were looking for?
hallzAuthor Commented:
Hi BlueDevilFan,

I think you understood, I am simply writing a script to process a section of an email message, selected text would have been more convenient but as the message content is system generated I can find the information with some code and process from there.

Thanks for your Help,

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
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.