macro in powerpoint add-in cannot be activated although add-in is loaded along with low macro security setting

Dear Experts

I have created a ppam file that contains a macro. The macro works fine. I also created a custom command button on the ribbon for the macro.

I have loaded the add-in manually thru the regular 'load available add-ins' dialog box.

I also set the macro settings to: enable all macros (not recommend; potentially dangerous code can run)

So everything is fine. But still,  if I run the macro thru the user-defined macro button I keep getting the following message box:

The macro cannot be found or cannot be run because of your macro security settings.

I am pretty sure the add-in has been loaded (because it shows under options - add ins PowerPoint Add-ins), but the macro in that add-in somehow cannot be activated.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
Andreas HermleTeam leaderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jamie GarrochSenior Technical Consultant at BrightCarbonCommented:
That message is a very generic and misleading one from Microsoft. It "can" be triggered as it says due to macro security but it can also be generated if your customUI XML callback does not match the expected callback signature in your VBA. What is the XML you are using for the button and what is the callback signature you have e.g.


<button id="myButton" onAction="OnAction"/>

Open in new window


Public Sub OnAction(control As IRibbonControl)
  Select Case
    Case "myButton": 'Do stuff
    Case Else: Debug.Print "OnAction not handled for : " &
  End select
End Sub

Open in new window

Andreas HermleTeam leaderAuthor Commented:
Hi Jamie,

thank you very much for your swift and very professional help.

Uppps, you are telling me that the command button on the ribbon can only be made thru XML coding.

I just did it with the built-in 'customize ribbon' functionality.
Andreas HermleTeam leaderAuthor Commented:
I am off to catch my train. Any comments from you, Jamie or other experts, I will only be able to address later tonight.

Thank you
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Jamie GarrochSenior Technical Consultant at BrightCarbonCommented:
I know you can use that method to add a custom button for a macro in the active presentation (.pptm) but I don't think that can be made to work for a .ppam But, if you can write macros, adding XML to your project isn't that difficult. You can do it manually by adding a customUI.xml file in a customUI folder in the root of the ZIP archive of the pptm file (rename it .zip, unzip, edit the contents, rezip, rename to .pptm) or you can download the free CustomUI Editor (Google it) and just add the code like below:

<customUI xmlns="">
      <tab id="myTab" label="My Tab">
        <group id="myGroup" label="myGroup">
          <button id="myButton" label="myButton" onAction="OnAction"/>

Open in new window

Jamie GarrochSenior Technical Consultant at BrightCarbonCommented:
I confirmed that the method you're using won't work as expected. I created a test pptm file with a test macro. I then added a command to that macro using the backstage Customize Ribbon functionality. Having saved the file as a ppam and loaded it as an add-in I then exported the ribbon customisation (File / Options / Customize Ribbon / Import/Export) and looked at the XML it generated. This is the snippet for the new button:

<mso:group id="mso_c1.66956DC" label="New Group" autoScale="true">
	<mso:button idQ="x1:_Custom_Button_Test.pptm__Test_0_66EAE79"
		label="'Custom Button Test.pptm'!Test"
		onAction="'Custom Button Test.pptm'!Test"

Open in new window

You can see that the onAction callback is referring to the pptm file and not a ppam file. That's why you're getting the error because the button's XML callback is looking for the macro in the wrong file. So, once the code is in an application add-in, there appears to be no way to reference is using the backstage Customize Ribbon UI. The root of the issue is that you're creating the custom button in the PowerPoint UI customisation and not inside your project file.I'd recommend using the CustomUI Editor as mentioned above or the free version of Visual Studio so that the customUI part travels with the pptm and corresponding ppam files.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Andreas HermleTeam leaderAuthor Commented:
Wow what a superb support!!!
Thank u very much

Will award points tomorrow ...
Andreas HermleTeam leaderAuthor Commented:
Hi Jamie,

thank you very much for your swift and very professional help. This is superb support from your side.

I now know that  the built-in functionality just won't work in my case. I will know try to do some programming with the Custom UI Editor.

Again, thank you very much for your great support.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.