Mac – How to get a macro to run in Outlook 2010

macrosmicrosoft-outlookmicrosoft-outlook-2010trust

I've written a macro for Outlook and would like it to be run from a button which is visible whenever you compose an email. As such, I've added a button to the Quick Access Toolbar pointing to the macro, given it an icon and renamed it.

I've also gone into the Trust Center (File > Options > Trust Center > Trust Center Settings.. > Macro Settings) and changed the security level to "Notification for all macros".

I've restarted Outlook yet when I click on the button nothing happens. In Outlook 2003 and Outlook 2007, this would have been enough to get the macro to run.

I've added a breakpoint to the first line of the macro and it is never run. I can only conclude that this means that somewhere Outlook 2010 is still stopping macros from being run.

Does anyone know what else I need to do to encourage Outlook 2010 to run macros?

Best Answer

You need more info for me to give you a good enough answer, but here's a quick overview of what I did and was successful to get a macro going.

If you're looking to have a macro run based on an event:

This means you're looking to have your code run based on events that happen within outlook. For example, Application_Startup.

Under the Developer IDE (Alt + F11) select Microsoft Outlook Objects -> ThisOutlookSession

enter image description here

Then Select the dropdown that says General and Select Application. You'll then be able to select all the event driven methods that you can add. For Example:

enter image description here

If you're looking to just run a Macro

In the IDE, select the toolbars creation button dropdown and select Module

enter image description here

Within the code, create you're module:

Sub test()

    MsgBox "Hey Look a Macro!"
    
End Sub

You can then run it from the Developer tab:

enter image description here

Note: You have to make sure that you enable ALL macros in the security center

For more information I would highly suggest you read up on the Developer's website material.

Related Question