2

Using Excel 365.

My workbook has macros which are linked to buttons or shapes on several worksheets. The macros work if I run them from the Macros dialog, or the VBA editor, but when I press a button or shape, I get the message:

"Cannot run the macro <Filename!macroname>. The macro may not be available in this workbook or all macros may be disabled."

I tried it with the "Enable all macros" setting, but that did not help.

The strange thing is, sometimes the button do work. And on at least one occasion, when I closed and reopened it, they did.

5
  • 1
    In which module did you place the code for this strange macro?
    – JohnSUN
    Commented Nov 29, 2021 at 9:43
  • 1
    Is the macro linked to the on_click event of the control? Commented Nov 29, 2021 at 9:47
  • These macros are in ordinary modules. The buttons are Form Controls, not ActiveX. They (and the shapes) are connected to the modules through "Assign Macro..." on the right-click menu. Commented Nov 29, 2021 at 21:43
  • I'm having the same issue suddenly. Which version of Microsoft Office are you using? I feel like it might have something to do with the most recent update.
    – GWD
    Commented Nov 30, 2021 at 8:13
  • I'm using Office 365, which is updated continuously Commented Nov 30, 2021 at 23:50

1 Answer 1

0

I've found changing the Trust Centre Macro settings to accept Excel 4.0 macros gets past this problem. But this is less than ideal. Hopefully someone has a better fix.

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Feb 7, 2022 at 6:56

You must log in to answer this question.

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