9

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?

1
  • 1
    where are you writing the code?....is it under ThisOutlookSession?? can you post the code here? Jul 11, 2012 at 11:19

2 Answers 2

7

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.

1
  • Instead of compromising security and enabling all macros, you can self sign your macro by running selfcert.exe, installing the certificate at the trusted root certification - local computer, reopening outlook and chosing always trust this publisher (or if it doesn't pop up on outlook initial load manually press alt-f11 and then choose always trust this publisher).
    – BornToCode
    Feb 6, 2017 at 9:01
0
+50

It turned out my installation of Outlook was corrupted, which is why macros were not running.

One re-install later and everything worked fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .