Welcome to MSDN Blogs Sign in | Join | Help

Adding a VBA Macro to Outlook

Silly me.  When I posted the macros to create Outlook appointments based on email messages and to schedule your drive time, I failed to explain how to add VBA Macros to Outlook.  Well here's how:

  1. For the macro that you want to add, like NewMeetingRequest.bas, right-click on the file hyperlink in Internet Explorer and select Save Target As... and save it to your desktop or in Firefox, click on the hyperlink and select File...Save Page As...and save it to your desktop. (Remember the location where you saved it).
  2. Start Microsoft Outlook 2007
  3. In the Tools menu, select Macros...Visual Basic Editor
  4. In the Visual Basic Editor, you should see a project explorer in the left hand pane.  If you don't see it select View...Project Explorer:
  5. Select File...Import File... and select the .bas file that you downloaded in step 1.  Doing so will add the module to Outlook and it will be listed in the Modules folder.
  6. Now you might want to add the macro to the Quick Access Toolbar in one of the item explorers in Outlook.  To do this, open an explorer by double-clicking on the item in Outlook (like a contact, an appointment, an email message, etc.).  Each class of explorer has its own Quick Access Toolbar, so if you want to add a macro to the quick launch toolbar of existing emails, open an existing email; if you want to add a macro to existing appointments, then open an existing appointment.
  7. Click on the Customize Quick Access Toolbar button and select More Commands... from the menu.
    This is not a real email message (but I'd love to have dinner with Mr. Gates.)
  8. Change the Choose commands from drop down to Macros.
  9. Select one of the macros in the left list and press the Add >> button to add it to the Quick Access Toolbar button list on the Right.
  10. With the new button selected on the right, press the Modify button below to select a new icon and/or display name (to show when hovering over the button); press OK.
  11. Press OK again to save the changes to the Quick Access toolbar

Now the macro is hooked up to a button in the Quick Access toolbar and ready to use.

Published Wednesday, May 23, 2007 8:38 PM by Michael S. Scherotter
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Adding a VBA Macro to Outlook

this is really cool, I will for sure make strong use of this!

thanks for sharing this

cheers

martin

Monday, July 02, 2007 1:06 PM by Martin

# re: Adding a VBA Macro to Outlook

This is awesome; been looking for something like this. However, every time I use this, it keeps asking me to "Allow Access to Outlook..."; Outlook thinks this is a virus or something. Any way of always allowing access?

Thanks.

Tuesday, July 31, 2007 12:29 PM by Bala

# re: Adding a VBA Macro to Outlook

Can this be done for Outlook 2003?  

Tuesday, September 11, 2007 3:54 PM by Mike

# re: Adding a VBA Macro to Outlook

Agreed - Works Great - thanks!!!!

mark

Thursday, September 13, 2007 7:13 PM by Mark

# re: Adding a VBA Macro to Outlook

Mike,

This could probably be fairly easily adapted to Outlook 2003.  For Outlook 2003 you would add the macro to either a toobar or a menu instead of the Quick Access Toolbar.

Michael

Thursday, September 13, 2007 7:26 PM by Michael S. Scherotter

# re: Adding a VBA Macro to Outlook

Now time to show off.  Can you do that, but make a dropdown in QAT that you can select from a LIST of macros?  Ive been working on this for a week now myself and I am stuck, lol.

Thursday, October 11, 2007 4:24 PM by Daf

# re: Adding a VBA Macro to Outlook

So does anyone know how to bypass the security question: "Allow Access to Outlook..."

Wednesday, November 07, 2007 11:19 AM by SLB

# re: Adding a VBA Macro to Outlook

Add a digital signature to the macro as described in the MSDN Knowledgebase article.

http://msdn2.microsoft.com/en-us/library/aa155754(office.10).aspx

Tuesday, November 27, 2007 11:38 AM by Jim

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker