How to assign a hot key to a macro in Microsoft Outlook

I have the following code:

Sub ChangeCurrentView()
Dim myOlExp As Outlook.Explorer

Set myOlExp = Application.ActiveExplorer
If myOlExp.CurrentView = "Verzonden aan" Then
myOlExp.CurrentView = "Compact"
Else
myOlExp.CurrentView = "Verzonden aan"
End If
End Sub

Open in new window


I want a shortkey like alt+u or ctrl+alt+u or what ever to be bind to this code.

Anyone knows a solution how i can make this?
I am using Outlook 2010.
RemcoViAsked:
Who is Participating?
 
slycoderConnect With a Mentor Commented:
I suggest using "Alt+F8" then selecting it from the list.  Seems to be the fastest, most reliable.

Thanks
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Hello Remco, here's a tutorial about macro's in Outlook. There's a part where they set the hotkey to Alt-1, I can't test for you now so can you try and see if you can change to your desired hotkey?
0
 
RemcoViAuthor Commented:
This is not possible in Outlook 2010 i think , because i can't find the toolbar options or anything described in that link you gave.
0
Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

 
Gerwin Jansen, EE MVETopic Advisor Commented:
Ok, just found something here, you can add your code as a button to the quick access toolbar (and you will get an <alt> shortcut automatically).

Click the File tab, click Options to open the Outlook Options dialog box, and then click Quick Access Toolbar, follow steps at "Making Macros Accessible".
0
 
RemcoViAuthor Commented:
Problem with this is that the shortcut key is ALT + R -> Y -> 1

Thats not an easy shortcut.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
You are correct, this is not a easy shortcut :). I've been looking a bit more into it and it seems that it is not possible to assign custom shortcuts (like alt-u) in Outlook to macro's.

Instead, you could use a tool like Auto Hotkey to either perform the function you want in Outlook (linked to alt-u).
0
 
RemcoViAuthor Commented:
In practise this seems the best alternative. Thank you for your response.
0
All Courses

From novice to tech pro — start learning today.