VBA Macro

  • Thread starter Thread starter marc.derider
  • Start date Start date
M

marc.derider

I have some clients who e-mail me and their e-mail comes out as
<excerpt><bold><color>. I'm sure it's a pretty common occurrence.
What I would like to do is create a little macro such that I could
select text, press a hot key, edit the message and take the selection
and replace it with something else, in this case it would be the same
text with the text stripped of its ugly formatting tags.

I am looking for the quickest way to
1) Bind a VBA Macro to a hotkey.
2) Get the Active E-Mail Message
3) Get the Selection text inside of it.
4) Be able to toggle the Edit Message so that the message is
editable.
5) Replace the selection - should be trivial once I get a reference
to the actual selection text.
6) Save the message - probably trivial once I figure out how to
edit the message.

Where would be the best place to find information on how to do the
above? Any sample code, informative sites that go beyond Microsoft's
wonderful but virtually useless help files.

Thanks in advance.
 
You won't find information on much of this in the Help files because many of the items on your list are not supported.
I am looking for the quickest way to
1) Bind a VBA Macro to a hotkey.

Not supported except for Alt+ the character in a toolbar button's name that is preceded by an ampersand.
2) Get the Active E-Mail Message

Take a look at the Application.ActiveInspector and Application.ActiveExplorer.Selection objects.
4) Be able to toggle the Edit Message so that the message is
editable.

Not necessary when programming the content of against Outlook items.
3) Get the Selection text inside of it.
5) Replace the selection - should be trivial once I get a reference
to the actual selection text.

Not supported in received messages in the Outlook object object model. You'd have to use the Redemption library from http://www.dimastr.com/redemption/, which has a SafeInspector object that allows you to work with selected text in an open Outlook item.
6) Save the message - probably trivial once I figure out how to
edit the message.

Look at the MailItem.Save method.
Where would be the best place to find information on how to do the
above? Any sample code, informative sites that go beyond Microsoft's
wonderful but virtually useless help files.

Ask here, and check the code samples and articles at http://www.outlookcode.com.
 
Back
Top