create shortcut for macro in outlook

Create a macro in Outlook

You use Visual Basic for Applications (VBA) to create or edit macros in Outlook.

Create or edit a macro

To create or edit a macro by using Visual Basic for Applications (VBA), do the following:

On the Developer tab, choose Macros . See Show the Developer tab to learn how to display the Developer tab.

In the Macro dialog box, type a name for the macro.

Click Create to open Visual Basic for Applications (VBA).

Run a macro

For information about how to run a macro in Outlook, see Run a macro in Outlook .

Facebook

Need more help?

Expand your skills.

EXPLORE TRAINING >

Get new features first

JOIN MICROSOFT 365 INSIDERS >

Was this information helpful?

Thank you for your feedback.

create shortcut for macro in outlook

This forum has migrated to Microsoft Q&A . Visit Microsoft Q&A to post new questions.

Answered by:

Assign keyboard shortcut to outlook vba macro.

I have tried adding the macro to a ribbon tab, and renaming the command using an Amperstand in front of the letter I want to access the macro with.  However, the display of the command on the ribbon displays,

"Insert &Paragraph Symbol"

and the Alt+P does NOT call the macro.  How can I make the Alt+P run the macro.

I've read how to use Alt+1, etc. to run macros on the Quick Access toolbar; however, I want to keep them consistent with the keystrokes I have assigned for Word.

Hi Orlandp,

Thank you for posting in the MSDN Forum.

Outlook does not support assigning shortcut to macro like Word does. The best approach I can think of is to add a command to Quick Access Toolbar and use Alt+(Number correspond to the command).

Since your issue is relate to the usage of Outlook, I suggest you repost it on the Outlook Answers Forum  as well.

Hope it helps.

Best regards,

Quist Zhang [MSFT] MSDN Community Support | Feedback to us Develop and promote your apps in Windows Store Please remember to mark the replies as answers if they help and unmark them if they provide no help.

All replies

I tried using an Outlook macro similar to the one posted at http://stackoverflow.com/questions/9818047/excel-vba-assign-keyboard-shortcut-to-run-procedure which uses Application.OnKey but Outlook doesn't support the OnKey method. (My goal was ApplicationOnKey "+^v", "PasteUnformattedText: '  control shift v. ) and then run the macro when I start Outlook.

Perhaps because Word is used for editing a message I can wrap the above in the code that says to use Word's ability to assign keys to macros, but that is a bit beyond my Outlook coding at this time.

By the way, keyboard assignment stuff is described here: https://msdn.microsoft.com/en-us/library/office/ff197461.aspx?f=255&MSPPError=-2147217396

create shortcut for macro in outlook

Stack Exchange Network

Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Shortcut or macro for changing font type in Microsoft Outlook

Is there a keyboard shortcut for changing the font in Outlook on Windows? I have to alternate between Calibri and Courier constantly for technical reasons and clicking on the font dialog every time gets very tedious. I know that I can use Ctrl+Space to change anything to the default (Calibri) font.

If there is no shortcut, could someone please help me create a macro to toggle fonts? I imagine I can assign any shortcut to a macro?

Enigma's user avatar

2 Answers 2

(The answer by techie007 didn't work for me in Outlook 2010)

This macro (adapted from http://www.slipstick.com/developer/word-macro-apply-formatting-outlook-email/ ) does:

Next, in the VBA Editor go to Tools > References and select Microsoft Word 14.0 Object Library .

Now, to create a keyboard shortcut for a macro, add it to your Quick Access Toolbar as follows:

more-commands

macros

To run the macro highlight some text in your email, and press Alt + <Num> where <Num> is the position of the macro in your Quick Access Toolbar. For example, if the macro is the first button on the toolbar, use Alt + 1 to invoke it.

Phrancis's user avatar

Just FYI, this is the key sequence to focus the Font selector: Alt , H , F , F

Oliver Salzburg's user avatar

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged microsoft-outlook macros or ask your own question .

Hot Network Questions

create shortcut for macro in outlook

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Run Outlook macro from desktop shortcut

I am trying to run an Outlook 2013 macro from a desktop that I have already made and works good. I would like to be able to copy this shortcut to other coworkers computers as well.

Any idea's since the autorun function is not supported anymore?

Martijn Pieters's user avatar

Create a desktop VBScript ( *.vbs ) that uses the Office COM Automation API to run the macro.

Something like this:

You may need to use GetObject instead of CreateObject , as well as bringing the Outlook window to foreground.

Dai's user avatar

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged vba windows outlook or ask your own question .

Hot Network Questions

create shortcut for macro in outlook

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

site logo

Create or Generate Keyboard Shortcuts for Microsoft Office

Make your tasks so much easier

Author avatar

A mouse is a handy tool, but point-and-click is a waste of time. You knew that, so you went and learned the best keyboard shortcuts for Office and Windows already.

But maybe some repetitive tasks don’t have shortcut keys. Wouldn’t it be great if you could create your own keyboard shortcuts in Microsoft Office? Well, you can.

create shortcut for macro in outlook

How to Create Keyboard Shortcuts in Microsoft Office

Let’s go through these steps in Word first. The steps are identical in Excel and PowerPoint on the desktop. Scroll down to see how to do this in Outlook.

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

The FileSendPdf shortcut will automatically convert the document into a PDF, create a new email message in Outlook, attach the PDF, and give the email a Subject. One keystroke instead of a dozen or more point-and-clicks with a mouse is an incredible timesaver.

create shortcut for macro in outlook

How to Clear Custom Keyboard Shortcuts in Microsoft Office

You may wish to get rid of all the custom keyboard shortcuts you’ve made in an Office app. It’s simple to do.

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

How to Create Keyboard Shortcuts in Microsoft Outlook

Of all the Microsoft Office apps, Outlook is probably the one in which you spend the most time. It makes sense to create some custom keyboard shortcuts to get things done faster. 

Unfortunately, since Outlook 2016, it doesn’t allow you to make keyboard shortcuts as we can in Word, Excel, and PowerPoint. So what are your options?

It’s a workaround, but you can create Quick Steps and assign key combinations to them. This won’t give you the ability to create a shortcut key combo for everything in Outlook, but it can meet most of your needs. There is a limit of nine key combos that you can assign to custom Quick Steps.

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

create shortcut for macro in outlook

If you want to go a step further, you can create Outlook Desktop shortcuts using command line switches to make common tasks easier to do.

Practice Your Keyboard Shortcuts

Now you can create your own Microsoft Office shortcut keys. Print out a list of your most-used shortcuts and keep them beside your monitor. After a few days, you won’t need the cheat sheet anymore. Add in the command line switch shortcuts and it will boost your Microsoft Office productivity in no time. 

create shortcut for macro in outlook

Guy has been published online and in print newspapers, nominated for writing awards, and cited in scholarly papers due to his ability to speak tech to anyone, but still prefers analog watches. Read Guy's Full Bio

Read More Posts:

create shortcut for macro in outlook

Subscribe to Help Desk Geek.

Join 30,000+ others who get daily tips, tricks and shortcuts delivered straight to their inbox. 

Thanks for subscribing!

We will never spam you, unsubscribe at any time.

Excel Campus

More results...

Excel Campus

2 Ways to Assign Keyboard Shortcuts to Macros

Bottom Line: Learn two different ways to create keyboard shortcuts to run macros, and discover the pros and cons for both methods.

Skill Level: Intermediate

Download the Excel File

You can download the example Excel file I use in the video here:

Create Your Own Keyboard Shortcuts to Run Macros

Assigning keyboard shortcuts to simple or complex macros can help you work faster in Excel.  This is especially true if you have to perform the same actions repeatedly.  In this post we look at two popular ways to create the shortcut keys.  These include the Macro Options window and VBA code for the Application.OnKey method.  I also explain the pros & cons of each method.

1. The Macro Options Window: Shortcut Key

We can use the Macro Options window in Excel to create a shortcut key to call the macro.  Here are the instructions on how to set it up.

https://www.dropbox.com/sh/88073cmb7ynbhms/AABOSlOqoNMJ5hhRMGIdprf4a?dl=0

Be careful not to override an existing shortcut that you frequently use, such as Ctrl + C to copy. One way to avoid doing this is by adding Shift to the shortcut to make it a bit more complex. In my example, I used Ctrl + Shift + C .

Assign Keyboard Shortcut to Macro - Ctrl Shift Combination

To delete the shortcut , simply repeat the process for accessing the Macro Options Window and then delete the character that you entered to create the shortcut.

2. The Application.OnKey Method in VBA

We can also use VBA code to create shortcut keys for macros.  The Application.OnKey method allows us to create and delete the shortcuts.  It also gives us more options and flexibility with our keyboard shortcuts.

Start by accessing the VB Editor.  You can do this by clicking the Visual Basic button on the Developer tab, or pressing  Alt + F11 .

Developer Tab in Excel 2016 with Visual Basic Button to Open VB Editor

Create Shortcuts with OnKey

In the VB editor, we are going to write some simple code to assign a macro to a keyboard shortcut .

VB Code to assign a procedure to keyboard shortcut

Delete Shortcuts with OnKey

As you can also see in the image above, the code to delete this process is simple.  I've typed it just below the section for creating the shortcut.  Instead of “CreateShortcut” we will call it “DeleteShortcut” and we remove the procedure name (“CellColorGreen”) from the code.  The absence of a procedure tells Excel not to assign an action to that combination of keyboard strokes.

This also resets the key combination to any native Excel keyboard shortcuts.  For example, if we were using Ctrl + C instead, the keyboard shortcut would revert back to performing the Copy action when Ctrl + C is pressed.

Both the Create and Delete macros can have multiple lines of code with the OnKey method.  This allows you to setup different shortcuts for different macros all at the same time.

Automate OnKey with Events

However, you can actually automate this by using the Workbook_Open and Workbook_BeforeClose events.  Here are instructions on how to set it up (see the video above for more details).

Select ThisWorkbook in the VB Project Window

If your macros are stored in your Personal Macro Workbook , you can follow the same procedure as above.  Checkout this article on how to create your own Personal Macro Workbook if you don't have yours setup yet.

Pros & Cons for Each Method

For both methods, the keyboard shortcut can be used on any file we have open in Excel, as long as the file that contains the macros remains open.  Let's look at some of the advantages and disadvantages for each method.

Pros: Macro Options Window

Cons: Macro Options Window

Pros: Application.OnKey Method

Cons: Application.OnKey Method

The Verdict

So which method is better for macro shortcuts?  Well, my preferred way is the OnKey method .

With the OnKey method: it is much easier to find and see all of our shortcuts, we have more key options, and more control over quickly enabling/disabling multiple shortcuts.

There is no perfect solution, but I recommend using the OnKey method if you are going to set up multiple shortcuts in your Personal Macro Workbook .

Create Multiple Shortcut Keys with Application OnKey

If you like using keyboard shortcuts to make your work faster and more efficient, I recommend you check out my posts 18 VBA Macro Shortcuts and also The Best Keyboards for Excel Shortcuts .

I'd love to hear about the most useful shortcuts you've created, or want to create.  Please comment below to let me know or to ask any questions you might have about assigning keyboard shortcuts.

You may also like

Remove Multiple Levels of Indenting

Remove Multiple Levels of Indenting

3 Ways to Remove Duplicates

3 Ways to Remove Duplicates

Formatting Cells Quick Excel Shortcut

Find and Replace Formatting in Excel

WRAPCOLS IN EXCEL

Excel Bad Habit #11

Excellent, very well explained, thank you…..

Thank you Mark! 🙂

I enjoiyed this one. I have quite some macro’s in my PMW. SinceI followed the VB-Pro Course, I’ve setup a custom tab with buttons to run the macros I most use. Now I’m going to add shortcuts as well using the “Application.OnKey”.

Thanks again Jon.

Awesome! Happy to hear about all the macros in your PMW, and excited for all the progress you’ve made. Thanks Edil! 🙂

Hi Jon, Thanks for the valuable explanation. A few weeks ago you pointed me to the Onkey method. And I thought of this only as a method to use when there is no Ctrl+Shift shortcut available anymore for a certain letter with Macro Option.

But the tracking and maintenance aspect is indeed relevant. It was today very easy for me to find all my Onkey shortcuts (5), but the very first Macro Option shortcut comment I found in a module was wrong. I had deleted the shortcut as it was in conflict with a built-in shortcut (and I had brought a button to the QAT, so it was also somehow obsolete).

With built-in shortcuts and all the shortcuts for macros or e.g. paste buddy there is the danger that one pushes a wrong combination – and macros can’t be undone. Any ideas for a naming convention that could bring in some structure or grouping and would helps to differentiate more easily?

Thanks again!

Instead of using one shortcut key per macro (e.g. Ctrl+Shift+1, Ctrl+Shift+2), you can use one shortcut key that displays a menu of macros, selectable with a simple (or few) character(s) (e.g. F12 then 1, F12 then 2).

You can also use a VBA Enterpad to trigger your macros without using any shortcut keys at all.

Hi Matthias, For macros that clear the undo history you might want to have a Yes/No message box appear before they run.

Video #4 on this page on The Personal Macro Workbook explains how to add the Yes/No message box to any macro.

The Yes button on the message box has focus set to it by default. So all you have to do is press Enter when it appears. This is one way to prevent accidental keyboard shortcut presses that are assigned to macros.

I hope that helps answer your question.

It is a pleasure to watch a professional at work. Not only are you well versed in Excel but your presentation is well organized AND presented. There is nothing more distracting than listening to a speaker who frequently pauses with ‘ahhs’.

Thank you for the article, but the + is the code for Shift, the ^ is code for Ctrl.

Fantastic Video. I am pretty familiar with macros, but this video taught me 5-6 things I did not know. It was well presented, and at a great pace. Thanks!

It is MORE QUICK to write the code for shortcut into macro itself. Please write this way:

Sub MACRO_NAME () Attribute MACRO_NAME.VB_ProcData.VB_Invoke_Func = “X\n14”

After this you can write the code you want.

“X\n14” mean that when Ctrl+Shift+X is pressed, macro is started. You can change X with any other letter.

If the letter is capitalised, then the Shift key is used (and respective letter). If the letter is NOT capitalised, then just Ctrl key is used (and respective letter).

Keep the good work!

I have a macro from a long time ago and I saw that it was already assigned a bunch of shortcut keys. Do you know how I can run a macro to see all my assigned keys? Basically, I was wondering if you would be able to help me find a macro to uncover the problem you stated in Con #3 on the macro options window…

Jon, looks like the macros called by the OnKey method need to be placed in the “ThisWorkbook” or Module. Is there any way to reference a macro that is stored within a specific sheet? I didn’t see it referenced in your video or in the MSDN help page. Any idea on the correct way to format the code to reference a macro stored on a sheet?

I wanted to know if a macros is possible which using onkey “% {DOWN}” (alt + down arrow) I immediately enlarged the column width of that cell to 50 and then when leaving that cell the column width is 5 for example.

it’s possible?

I created a macro for a specific number format and assigned Ctrl + Shift + N to it. The macro will run if I go into the macros window and press Run but not using the shortcut. Any thoughts?

Thanks, Mardi

Hello and thank you for the wonderful education. I am quite new at macros and VBA codes, so playing with some spreadsheets and data that I have put together. My questions are: – 1. Is there a way of allocating this type of macro / VBA code to a button? e.g. Either a shape or macro button, where when you press on the button it will take you to the end of the spreadsheet and one at the end to return home. 2, If you keep entering data and the end is now further down in the spreadsheet will the button automatically take you to the new end?

Thank you and sorry for my ignorance Martine

Pl. send me VBA code or any other method to 1. Jump to any worksheets 2. Rename multiple sheets as per a list. Thanks & Regards VENU. P.K [email protected]

Could you please help me with creating a macro for different keys the different comments display on Excel sheet.

For ex : if we press Ctrl+shift+A the particular Cell should display as “Tutorial”. And next Ctrl+shift+B the cell should display “Classes”

Please help me to get this.

Thanks you…

Thanks for a great tutorial. FWIW, your video contains an error. At about 10:46 your voiceover says “control alt” but the code on-screen is “+%” which is “shift alt”.

OnKey instructions were very helpful!

Annoyingly, i have done this absolutely perfectly but when i press my shortcut keys i get “no cells found” yet when i run the code manually it works without a problem. DAMN YOU MICROSOFT!

Excel Shortcuts List

keyboard shortcuts list banner

Learn over 270 Excel keyboard & mouse shortcuts for Windows & Mac.

Join Our Weekly Newsletter

The Excel Pro Tips Newsletter is packed with tips & techniques to help you master Excel.

create shortcut for macro in outlook

Session expired

Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.

How to use Outlook's VBA Editor

Slipstick Systems

Last reviewed on June 19, 2021       307 Comments

The steps are the same for all versions of Outlook and all Office applications

It's easy to find code samples on the Internet, but unless you know how to use them, they aren't going to do you much good.

We're going to assume the code is 100% ready-to-use, not a code snippet that is half complete.

If the code will be run against items in your mailbox or personal folders, you should make a backup of the mailbox or data file, just in case something goes wrong with the code. If the code runs against a specific folder, copying the folder and contents may be enough "insurance", (You should have routine backups regardless, but I know many users don't bother.) At least very least, make a copy of the items in the folder you are running the code against.

Check Macro Security Level

Before you begin, you'll need to check your macro security setting, otherwise, you'll need to use selfcert.exe to sign your macros to test them.

Enable Macros in Outlook's Trust Center

Outlook 2007 and older: Access the dialog to change the security level from Tools, Macros, Security .

Outlook 2010 and up: File, Options, Trust Center, Trust Center Settings, Macro Security .

It's highly recommended that you set the Macro Security level to only allow digitally signed macros. Do not choose the Low option (run all, never ask), except during testing. Note that some security software will set it to High and your macros will not run. You may need to restart Outlook after changing the security setting.

Open the VBA Editor

Now you are ready to open the VBA Editor. Press Alt+F11 on your keyboard, or if you are showing the Developer ribbon, click the Visual Basic Editor command to open it. In Outlook 2007 and older, the command in on the Tools, Macros menu.

Visual Basic Editor

If your screen does not resemble the screenshot above, with the white editing pane open, you'll need to click on Microsoft Outlook Objects to expand it then double click on ThisOutlookSession to open it in the editing pane on the right side. To add a module to the VBA project, right click on Project1 and choose Insert > Module to insert a new module.

Generally speaking, you can put the code into either ThisOutlookSession or a Module , unless otherwise noted that it must be in ThisOutlookSession or a module.

Application_Start macros must be in ThisOutlookSession .

Starting out with Outlook Macros Video Tutorial

This video tutorial shows you have to change the macro security settings, add a macro to Outlook, run the macro, and then create a digital signature using SelfCert.exe to sign the macro before increasing macro security.

Set a reference to other Object Libraries

If you receive a " User-defined type not defined " error, you need to set a reference to another object library.

Reference the Word object model in Outlook's VBA Editor

Commonly used libraries are Microsoft Word, Microsoft Excel, Microsoft Forms, and VBScript Regular Expression.

Run the Macro

Click the button to run the macro

Ctrl+Break will pause the macro, or press the Stop button on the toolbar to end it.

If you will be using the macro often, you should use selfcert to sign it then set Macro Security to only allow signed macros.

Don't sign the macro until you are done tweaking it and if you tweak it later, you'll need to re-sign it.

To run the macro from Outlook 2007 or older, go to Tools, Macro, Macros and select the macro. In Outlook 2010, you need to show the Developer ribbon first (File, Options, Customize Ribbon - check Developer ribbon on the right). You can also open the Macros dialog using Alt+F8 (all versions). You can also add macros to toolbar or ribbon buttons.

Using SelfCert to sign a macro

To sign a macro using selfcert , you first need to create a certificate. You can find selfcert in the folder with your Office files. In Outlook 2010 and older (as well as Outlook 2013 in volume licensing), selfcert is usually at C:\Program Files\Microsoft Office\OfficeXX where XX is your version of Office.

self-cert

In Outlook 2013 and 2016 "click to run", users will find selfcert at C:\Program Files\Microsoft Office 15\root\office15 (or Office16), or in C:\Program Files (x86)\Microsoft Office 15\root\office15 (or Office16) if using 32bit Office on 64-bit Windows.

With any Office version, if you use 64-bit Windows and 32-bit Outlook, selfcert will be in the 32-bit Programs directory.

In Windows 8 or 10, you can right click on the Outlook tile on the Start screen or Start menu and choose Open File Location ( More > Open File Location in Windows 10). This opens Windows Explorer to the location of the Office shortcuts. Right click on the shortcut and again choose Open File Location to open Windows Explorer to the folder where Outlook.exe is. Type S to jump down then double click on SelfCert.exe)

It's simple to use: just type a name for your digital certificate then click ok.

Once you have the certificate, sign the macros using Tools, Digital Signature dialog and choosing a certificate. When you close Outlook, if you are asked to save the VBA project, click Yes, even if you saved it from the VBA editor.

Note that every time you edit the macro you'll need to resign it.

Using SelfCert Video Tutorial

Add Macros to the toolbar or ribbon

If you are going to be using a macro often, you will probably want to create a toolbar button for it.

Customize Outlook 2010 and 2013 ribbon

You'll need to add a new Group to an existing ribbon tab or add a new tab and new group before selecting Macros from the Choose commands from menu. Select the macro and click Add to add it to the selected group in the right pane.

In Outlook 2007 ribbons: you can only add buttons to the QAT. Right click on a ribbon tab and choose Customize Quick Access Toolbar. Select Macros from the Choose commands from menu then select the macro and Add it to the right pane. (When you add buttons to the QAT you can use Alt+ n keyboard shortcuts.)

macros-toolbar

Drag the macro from the right side to the toolbar and drop. Right click on it to edit the name and button image.

More Information

Need help with sample code? Try the forums at Outlookcode.com or the Microsoft programming forums at MSDN

Looking for sample code? Outlookcode and VBOffice.net have a large number of code samples.

create shortcut for macro in outlook

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

I inserted a module, put in the code, named the module, used selfcert to create a certificate, enabled signed macros (even tried enabling all macros), but still NOTHING shows in the macro box. I am using Outlook 365 in Windows 11 with Exchange. Any ideas as to what I might be doing wrong?

Hi Diane, first of all, thank you very much for what you do. I learned a lot, and continue to use a lot of your examples of VBA code in my professional life.

I need your help in an Outlook VBA code, I browsed through forums, but couldn't find a solution to this. Probably super simple.

I'm using this code to split the name of the sender, and when I hit reply, it populates the body of the email with "Hi + strName".

strName = Split(Split(olReply.To & ";", ";")(0), " ")(0)

Now, how can I get the last element of the split name?

I know it's on the last 0, but don't know how to get there. You see because some people have 3 names, and some have only 2.

And I would like to get always the last index since the order of names is Surname (MiddleName, sometimes) FirstName.

Can you help?

In the section "Using SelfCert to sign a macro" you say "selfcert is usually at C:\Program Files\Microsoft Office\OfficeXX".

I believe that (unless you are using 64 bit Outlook) the correct path would be : "C:\Program Files (x86) \Microsoft Office\Officexx"

It would be in the same folder as the rest of the office apps - so, yeah, for 32 bit on 64bit windows, it would be in the x86 path. I wrote it back when 32-bit was still the thing.

In the section "Using SelfCert to sign a macro" you say "Note that every time you edit the macro you'll need to resign it."

I have not found this to be true in my Outlook 2010. Once I have signed my project it does not require me to resign it no matter how extensive the changes. I have to assume you are right and I am wrong. So, what am I missing?

I am looking for a steer towards the correct code to enter in the ThisOutlookSession module that, for incoming mail items, gets the senders email and searches my outlook contacts (including) subfolders. Upon finding a match, gets the contact item category and automatically applies the same category to the mail item.

Can this be done?

https://www.slipstick.com/developer/categorize-messages-using-contact-category/

It should work with all contact folders that are enabled as address books or for 'check address before sending' in address book options.

thank you for your reply. I have tried this code before and again following your comment.

Although it returns no errors within outlook at startup, I get no positive results. If I invoke the assign macro manually (as per the code comments) in existing inbox items it does nothing.

Hence, the shout out

Are the contacts in the default contacts folder?

Add msgbox lines throughout to see if they pop up - before end sub in app startup add msgbox "Started"

before the statement in the macro that sets categories- add msgbox "Sender is " & Item.Sender

after the line to set oContact, add msgbox "oContact is " & oContact.name

All my contacts are in subfolders within contacts. There are no contact records at the top level

That could be the problem. I'm out of town for a family emergency, but will take a look at making it work when I come back.

Great, thank you - the solution is alluding me at present

Posted on the wrong article - please ignore.

My value for Birth Month.Day for a Start of Oct 1st and Oct 10th both return the same decimal value on my table view as "10.10". My manual sort is naturally out of order. Thank you for any help!

You need to use 4 digits - 10.01 and 10.10

Hello I need some help please. I have created a form outlook to be filled in but unable to get the right vba code. I was able to create the form in excel and code it to work as it should. But unable to duplicate it in outlook. Can you assist please.

I am needing to modify the calendar explorer to show multiple appointments that start at the same time vertically instead of horizontally just arranged alphabetically and expanding the cell as needed. I would also like the ability to add a Boolean for "completed" on the Appointment form and added to the context menu, and when true, change the color of the calendar item. Also, since this will be published to a WebDAV server, I would like at least the completed property to be sent along with updates..

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Mail Tools for Outlook

Online Services

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Outlook Suggestion Box (UserVoice)

Slipstick Support Services

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer Outlook for Mac | Common Problems | Utilities & Addins | Tutorials Outlook & iCloud Issues | Outlook Apps EMO Archives | About Slipstick | Advertise | Slipstick Forums Submit New or Updated Outlook and Exchange Server Utilities Send comments using our Feedback page Copyright © 2023 Slipstick Systems. All rights reserved. Slipstick Systems is not affiliated with Microsoft Corporation.

Sign up for Exchange Messaging Outlook

Our weekly Outlook & Exchange newsletter (bi-weekly during the summer)

Please note: If you subscribed to Exchange Messaging Outlook before August 2019, please re-subscribe.

Never see this message again.

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Using Visual Basic for Applications in Outlook

Visual Basic for Applications (VBA) makes it easy to control Microsoft Outlook within Microsoft Outlook itself. Using VBA in Outlook, you can create macros that perform complex or repetitive tasks automatically. You can also develop program code that responds to Outlook events, allowing you to automate common tasks (such as arranging windows when Outlook starts).

Visual Basic for Applications allows you to take almost full advantage of the Outlook object model, including the wide range of application-level events, without requiring you to run an external application (such as another Microsoft Office application or an application developed using Microsoft Visual Basic). And unlike form scripts developed using Microsoft Visual Basic Scripting Edition (VBScript), Outlook Visual Basic for Applications code is always available in the application; an item does not have to be open to run the code.

All Outlook Visual Basic for Applications code is contained in a project. The project is associated with a particular user, so all users who run Outlook on a computer can customize Outlook to meet their own needs. A project can contain code modules and User Form modules (note that User Form modules are not the same as Outlook forms ).

You use the Visual Basic Editor to create and remove modules, to design User Form modules, and to edit code in modules. This editor provides a powerful set of tools, including a built-in Object Browser and debugger to make developing and troubleshooting code easy. You can even use the Visual Basic Editor in Outlook to develop and test code that you can then copy to a standalone Visual Basic application or a Visual Basic for Applications application in another Microsoft Office application.

Managing Multiple Visual Basic for Applications Projects

Outlook supports only one Visual Basic for Applications project, Project1, at a time. You cannot add and run another project in the Visual Basic Editor at the same time. Project1 is stored on your hard disk as VbaProject.OTM; each user on the same computer can have a copy of VbaProject.OTM stored for him or her. On a computer running Windows XP, VbaProject.OTM is in <drive>:\Documents and Settings<user>\Application Data\Microsoft\Outlook.

Because you can run only one Visual Basic for Applications project at a time, before you run a different project, you should exit Outlook, rename the current VbaProject.OTM with a different file name, name the project you want to run as VbaProject.OTM, and restart Outlook to run it. If appropriate, you can also manually integrate the projects to form one VbaProject.OTM to avoid the file naming and renaming.

Outlook Visual Basic for Applications code was designed to be a personal macro development environment, and was not designed to be deployed or distributed. To move a project from one computer to another, for example, moving the project from your work computer to your home computer, you can export the forms and code modules from the work computer and import them to the home computer. You can also copy and paste the source code of the project to Project1 on the home computer using the Visual Basic Editor.

If you are developing a solution that you intend to distribute to more than a few people, you should convert your Visual Basic for Applications code into an Outlook COM Add-in. However, developing a COM Add-in typically requires considerably more programming knowledge than creating a short macro, so if your Visual Basic for Applications project is relatively simple, and there are not too many people who need to use it, you may want to send them the code with instructions on how to set it up.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Additional resources

Ultimate Guide To Create Macros and Assign Shortcut key In Microsoft Word | 2022

Macros are small sets of codes that allow you to perform repetitive activities.  We use macros on documents that have vital data and simplify the work on the word document. However, a wrong command or code can be harmful to your document and make you lose your data permanently. In case you have a word document with such issues, we have a solution for that in form of a Remo Word Repair Tool. Make use of it to repair a damaged word document into a healthy safe file.

If you are one of those Microsoft Word users regularly performing a repeated set of activities, then Macros are for you. Creating Macros will not only make your work easier by just assigning a shortcut key but also helps you a lot of time. Follow this article, to learn how to create Macros and add a shortcut for Macros in a Word document.

What are Macros?

Macros in a Word application i s a short piece of code that runs in the background. Creating Macros in Word can help you improve your work experience with Microsoft Word by finding a shortcut for repeated sets of actions on it. 

Say you want to run a formula or insert a template into your Word document regularly for multiple Word files, Macros can do this in just a simple assigned keystroke saving you time and effort. 

Creating Macros in Word doesn't require you to be a technical geek. You can simply create Macros by using the Macros Recorder to record a sequence of actions. To create Macros, you are required to assign the specific key combination to perform repeated actions on any of your Word documents. 

NOTE: Macros in Microsoft Word can also pose a threat to be used as a potential malware vehicle to corrupt the Word document. In order to avoid corruption of Word files, it is recommended to maintain a backup copy of word documents. If you are facing any issues with MS Word then read more to learn how to protect Word documents .

How to Create Macros and Assign Shortcut Keys on Word? 

You can create and assign macros a shortcut key by following the steps given below

create macros in microsoft word

How to Add a Shortcut Key for Existing Macros?

If you have existing Macros then you can assign shortcut keys. This results in Macros being executed. Follow the steps below to assign a shortcut key for existing Macros  

Now try pressing the assigned shortcut key in the same document to which you created the Macros. Your Macro should run perfectly and perform all the actions that were recorded. 

Since Macros are small pieces of code written in a programming language, much like any other software program. You cannot rule out the chances of incorrect codes damaging the document or the virus threat to the document. In such cases, you will not be able to access your Word document.

It is recommended to use  Remo Repair Word for free , a powerful word repair tool specially designed to repair corrupt or damaged Word in a few clicks only. This Word repair tool is built-in with advanced repairing algorithms that help to repair the corrupted word document to recover its content without any alteration. You can recover all your content, formatting, alignments, hyperlinks, images, etc. All of this can be tried completely free. Download the tool and start repairing the document now.

Download Word File Repair tool for free

Repair Word document with Remo Repair Word

Browse the word repair file

3. Click on the Repair option to start repairing the Word file.

Repair the file

4. Once the Word document is repaired, you can preview the file to judge the success of the software.

5. Select the Save option to save the repaired Word file to the desired location.

Save the file

Hope this article was helpful in creating Macros and adding a shortcut to the Macros. Do share this article if you found it helpful and let us know your thoughts and queries in the comment section below.

Default image

Tony Landry

Tony Landry is a Web Content Editor at Remo Software. He loves to write, edit, and manage content for users trying to troubleshoot and fix problems on Windows, Outlook, storage drives and Cloud storage networks.

He has published more than 200 articles in Remo Software blog. He actively engages in research and problem-solving techniques to consistently generate great web content. Fixing various hardware problems on computer and storage devices along with a great knack for fixing Outlook errors, Tony is also the fun-time IT guy for all his work friends. He lives in the San Francisco Bay Area and enjoys cycling.

Leave a Reply Cancel Reply

Name  *

Email  *

Save my name, email, and website in this browser for the next time I comment.

Post Comment

IMAGES

  1. How to create Outlook macros in Office 2016 & 2019?

    create shortcut for macro in outlook

  2. Macro Mondays

    create shortcut for macro in outlook

  3. Creating an Outlook Desktop shortcut in Windows 10

    create shortcut for macro in outlook

  4. 2 Ways to Assign Keyboard Shortcuts to Macros

    create shortcut for macro in outlook

  5. 2 Ways to Assign Keyboard Shortcuts to Macros

    create shortcut for macro in outlook

  6. Starting Out with Outlook Macros

    create shortcut for macro in outlook

VIDEO

  1. Recessionary Pressures, Signals & Impact

  2. China’s Economy in 2023

  3. Japan’s Losing Battle with Debt

  4. E8 Topic 5

  5. Midi Control In PREMIERE

  6. Export Outlook body content in Excel

COMMENTS

  1. Create a button for a macro

    The keyboard shortcut to bring up the Macros dialog box is ALT+F8. This shortcut works even when the Developer tab isn't enabled. Create a button on the Quick Access Toolbar The Quick Access Toolbar (QAT) is the line of icons that appears above the Ribbon and is placed within the Title Bar of the window.

  2. Keyboard shortcuts for Outlook

    Use keyboard shortcuts to add accent marks and special characters To add accents or special characters, use the number pad on your keyboard with Num Lock turned on. Press and hold Alt. Type the numeric code on the number pad and release Alt. Top of Page Vowels with accents

  3. Create a macro in Outlook

    To create or edit a macro by using Visual Basic for Applications (VBA), do the following: On the Developer tab, choose Macros. See Show the Developer tab to learn how to display the Developer tab. In the Macro dialog box, type a name for the macro. Click Create to open Visual Basic for Applications (VBA). Run a macro

  4. Writing an Outlook Macro

    In Outlook, on the Developer tab of the Microsoft Office Fluent ribbon, click Visual Basic. In the Project window, double-click the module you want to contain the macro. On the Insert menu, click Procedure. In the Name box, type a name for the macro. The name cannot contain spaces. Click OK.

  5. How do I assign a keyboard shortcut to a VBA macro in Outlook 2007?

    I know how to create a tool for the macro and put it in a menu with an underscore shortcut. This solution requires me to use a shortcut of Alt + {menu key} + {tool key}. What if I want to assign it to Alt + F12 or something like that? The Visual Basic Editor is assigned to the keyboard shortcut Alt + F11 in Outlook 2007.

  6. Assign keyboard shortcut to Outlook vba macro

    Outlook does not support assigning shortcut to macro like Word does. The best approach I can think of is to add a command to Quick Access Toolbar and use Alt+(Number correspond to the command). Since your issue is relate to the usage of Outlook, I suggest you repost it on the Outlook Answers Forum as well. Hope it helps. Best regards,

  7. Shortcut or macro for changing font type in Microsoft Outlook

    Next, in the VBA Editor go to Tools > References and select Microsoft Word 14.0 Object Library. Now, to create a keyboard shortcut for a macro, add it to your Quick Access Toolbar as follows: Open a new mail message; Click on the small drop down arrow on the Quick Access Toolbar (typically located at the top of the window) and select "More ...

  8. vba

    Create a desktop VBScript ( *.vbs) that uses the Office COM Automation API to run the macro. Something like this: Option Explicit Dim outlook Set outlook = CreateObject ("Outlook.Application") outlook.Run "MacroName". You may need to use GetObject instead of CreateObject, as well as bringing the Outlook window to foreground. Share.

  9. How do I assign a shortcut key to a phrase that I use often in typing

    Macros are for manipulating documents, or parts of them, not for typing text in Word. You would not want to reassign the function keys (or at least I would not want to) because they all have useful assignments in Word already. However Alt- Ctrl- Ctrl-Alt Shift-Alt- and Ctrl-Shift-Alt- combinations with letters are all available.

  10. Inserting Auto Text into an email

    Shashirekha. To insert auto text in your emails you can follow the steps given below:-. 1. Type your text into the email body area. 2. Highlight the text you want for your AutoText Entry. 3. Once the text is highlighted... click at Insert > AutoText > New (Or you can simple hit Alt+F3). 4.

  11. Create or Generate Keyboard Shortcuts for Microsoft Office

    Right-click on any grey space in the ribbon area and select Customize the Ribbon. The Word Options window will open. Select Customize next to Keyboard shortcuts near the bottom of the window. The Customize Keyboard window will open. Look in the Categories area to narrow down to a tab which has the command you want to create a shortcut for.

  12. 2 Ways to Assign Keyboard Shortcuts to Macros

    After selecting the macro that you want to assign the shortcut to, click the Options button. In the Macro Options Window, you can create the shortcut you want by adding a letter, number, or symbol. Be careful not to override an existing shortcut that you frequently use, such as Ctrl + C to copy.

  13. Shortcuts to open Outlook folders

    The macros on this page should be placed in a module. Open the VBA Editor by pressing Alt+F11 on your keyboard. To put the code in a module: Right click on Project1 and choose Insert > Module Copy and paste the macro into the new module. More information as well as screenshots are at How to use the VBA Editor More Information

  14. How to use Outlook's VBA Editor

    In Outlook 2007 (main interface) and older versions of Outlook: right click on the toolbar area and choose Customize. Switch to the Commands tab and find Macros on the left. Drag the macro from the right side to the toolbar and drop. Right click on it to edit the name and button image. More Information Need help with sample code?

  15. Using Visual Basic for Applications in Outlook

    In this article. Visual Basic for Applications (VBA) makes it easy to control Microsoft Outlook within Microsoft Outlook itself. Using VBA in Outlook, you can create macros that perform complex or repetitive tasks automatically. You can also develop program code that responds to Outlook events, allowing you to automate common tasks (such as ...

  16. Ultimate Guide To Create Macros and Assign Shortcut key In Microsoft

    Now, to assign a shortcut for Macros, click on the Keyboard icon and click on the Assign button to add a shortcut key for Macros. An example of a shortcut key is (shift+ctrl+d). Once, you complete the typing of your documents and have assigned a shortcut key for Macros then stop Macros recording by clicking on the Macros > Stop Recording.