[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4656
  • Last Modified:

The macro cannot be found or has been disabled because of your Macro security settings

Hi:

I have a macro-enabled Word 2007 template with a custom ribbon menu tab created using Custom UI Editor.  I get the above error message twice in a row each time I create a new document based on the template or open an existing document based on the template.

Word is installed fine and working perfectly.  My ribbon and all my VBA macros run perfectly.  It's just a nuisance.  The error occurs before it ever gets to the Document_New code.  I think it occurs when it is creating the menu tab, as if it were finding macros missing.  But  I've verified that each "onaction" macro referred to in the ribbon code exists, and has the appropriate (control as iRibbonControl) next to it.

I've had this before but can't remember how I resolved it.

Any ideas how to make this go away?

Thanks
0
Bryce Bassett
Asked:
Bryce Bassett
  • 2
  • 2
1 Solution
 
TommySzalapskiCommented:
I assume that this error happens even if macro security is set to super low. This usually means there are two buried in there somewhere that you missed somehow.

Check the macros manager (Alt+F8?) and make sure there aren't any that refer to another document.

Can you post the template? (Remove all proprietary/private information of course). We can help you dig.
0
 
Bryce BassettFreelance VBA programmerAuthor Commented:
Tommy:

Correct.  The template lives in my usual Word templates directly, which is in my trusted locations to boot, and my macro settings are at the lowest level.

I did a little more digging on my own and believe I found the solution.

I narrowed it down to this first line of my XML code for the ribbon:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"  onLoad="OnLoad">

I removed  onLoad="OnLoad"  and my error messages are now gone.  I'm sure I just copied this line from another project I've done (a little knowledge is a dangerous thing).  What is that onLoad command anyway, and why would that have generated this error?

Thanks
1
 
TommySzalapskiCommented:
That is telling it to run the macro named "OnLoad" when the ribbon loads. So that would be the offending macro.
1
 
Bryce BassettFreelance VBA programmerAuthor Commented:
I found the answer on my own.  See above
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now