• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1802
  • Last Modified:

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

0
mcoleson
Asked:
mcoleson
  • 2
1 Solution
 
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
 
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

Featured Post

Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now