Forum Discussion
Marc_G2
Oct 13, 2023Copper Contributor
Can't run Form-Control-with-argument macro for no discernable reason
Update. I'm 99% sure the issue was somehow caused by me attempting to digitally sign my macro enabled document. I had done so repeatedly since I kept getting invalid signature errors. Clearing the signatures didn't fix the issues. In the end, I gave up and simply remade the document from scratch.
Let's say I have a function that takes a string argument.
If I want to run this function using a form control button, I can normally input 'TestFunc "abc"' in the assign macro window. However I have a particular document where this results in in error when clicking the button. It says "Cannot run the macro..... The macro may not be available in this workbook or all macros may be disabled."
If I run the document on a different computer, it runs like expected. If I remove the string input "abc", it works on this computer. If I create a new document on this computer and run the macro with an argument, it works like expected.
Help figuring out the cause of this would be appreciated.
I'm also not running any other Excel docs. So it's not some weird conflict issue. Also note that I'm running Office LTSC Professional Plus 2021.
Is TestFunc also the name of a module in that specific workbook?
Or could there be another name conflict?
As a workaround you could create a macro
Sub MyMacro() Call TestFunc("abc") End Sub
and assign this macro to the command button.
- Marc_G2Copper ContributorThe name of the module is something else. I've also tried moving the function to a different module which has no effect. And yes, I could use that as a workaround.
I'm thinking there might be a weird config problem or something might be corrupted. If go back to a much older version of the document, the problem isn't there.- Marc_G2Copper ContributorI created a copy of document and deleted everything except for the test function. I've also removed all library references. The issue persists...