how to make a shortcut to run Outlook Macro

I found how to create a macro to forward selected Outlook messages to a pre-defined recipient. (See the code snippet).

Now, I would like run the macro just by hitting a key combination (like Ctrl L) when the desired message(s) are selected.
How can I create a Shortcut to an Outlook macro?
thank you
Sub ForwardSelected()
    Dim intIndex As Integer, _
        olkMsg As Outlook.MailItem, _
        olkForward As Outlook.MailItem
    For intIndex = Application.ActiveExplorer.Selection.Count To 1 Step -1
        Set olkMsg = Application.ActiveExplorer.Selection.Item(intIndex)
        Set olkForward = olkMsg.Forward
        With olkForward
            'Change the email address on the following line
            .Recipients.Add "John@gov.org"
            .Recipients.ResolveAll
            Set .SaveSentMessageFolder = Session.GetDefaultFolder(olFolderDeletedItems)
            .Send
        End With
        'olkMsg.Delete
    Next
End Sub

Open in new window

mcolesonAsked:
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.

dynabitsupportCommented:
Ok... I think I have your solution!!!! Its not perfect - You need to use ALT + Shortcut Key instead of CTRL + Shortcut Key!
---

I am assuming that your macro security is appropriatly set.

In Outlook do the following;

1. Click on Tools > Customise
2. Select The Commands Tab
3. Select Rearrange Commands Button
4. Select Toolbar leave Standard as the selected Toolbar
5. Click on Add
6. Select Macros from the Category list
7. Select The Macro you want (which should already be there if you've created it already)
8. Click on OK
9. your Macro will be selected in the "controls" area on the left hand side of the Rearrange Commands dialog box. (You will also see it appear at the top of the screen on the menu bar)
10. Make sure its selected and then click on Modify Selection
11. Now all you have to do is give it a name. If you were to call your macro link "Macro 1" you can use the "1" as the launch link. Just enter the macro name as "Macro &1" You will see the 1 will be underlined, indicating it can be selected using ALT + 1.

As I said not exactly what you asked for (CTRL was required), but certainly a workable solution.

Make sure that the Assignment letter is not in use before starting this. Press ALT + (number or letter) if a menu opens or a dialog box appears it means the letter is not free. If you just get a beep - your good to go!


I hope this provides a solution to you.
0

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
mcolesonAuthor Commented:
This works very well. Now I either use the Alt+1 key, or just mouse click on the new menu item.
Very slick. Thank you.
0
dynabitsupportCommented:
Your Very Welcome!
0
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.