Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
1  
where are you writing the code?....is it under ThisOutlookSession?? can you post the code here? –  tumchaaditya Jul 11 '12 at 11:19

2 Answers 2

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.

share|improve this answer
up vote 0 down vote accepted
+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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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