How do I get a macro to run in Outlook 2010?

Solution 1:

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.