1. You can't. You would have to assign the macro to a button you add to a
toolbar or menu.
2. You can't. Selected text in the preview pane is not accessible to your
code.
3. Distributing macros is done by distributing the entire VBAProject.OTM
file, which wipes out any macros the user already has, since you must
overwrite their existing file.
The best way to do what you want for distribution is to write a COM addin.
It's more code but more easily distributable and maintainable.
See
http://www.outlookcode.com/d/comaddins.htm for information about COM
addins.
See
http://www.outlookcode.com/d/distributevba.htm for information about
distributing VBA code.
See
http://support.microsoft.com/?kbid=252426 for information about how to
call a macro from a toolbar button you create.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Amir" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I'm looking for a way to do the following 3 actions using VBA / VB in
> Outlook:
> (I'm using Office 2000 Proffessional)
>
> 1. Assign a shortcut key to a macro in Outlook.
>
> In Word I would have used something like:
>
> Dim kbNew As KeyBinding
> Set kbNew = KeyBindings.Add(KeyCategory:=wdKeyCategoryCommand, _
> Command:="MyMacroName", KeyCode:=BuildKeyCode(wdKeyControl,
> wdKeyAlt, wdKeyA))
>
> But how can I do that in Outlook?
>
> 2. Getting the current selected text. I mean the text which I select with
> the mouse in the preview of the current mail. In Word I would have used:
> Selection
> to get the current selected text. What is the equivalent in Outlook for
> the current selected text in the active mail message preview?
>
> 3. How can I distribute macros in Outlook? In Word I would have put the
> .dot template in the users' C:\Documents and Settings\Application
> Data\Microsoft\Word\Startup Directory, so that the template was loaded
> each time Word starts. In Outlook, there are no templates, so how can I
> distribute the macros to other users?
>
> I know VBA and a bit of VB.
>
> Kind Regards,
> Amir.
>