Hi,
I am looking for an easy way to check if a macro exists so it doesn't create an error if it isn't there or just ignores the call. The "main" macro is in a workbook that works with a lot of different workbooks, some that contain the "MyMacro" and some don't. And if it exists it should be run...
I tried
On Error Resume Next
Call ActiveWorkbook.Sheets("StartSheet").MyMacro
And if it doesn't exist, I end up with:
"Run-time error '438':
Object doesn't support this property or method"
Any ideas that doesn't require scanning through all macros of the workbook? It needs to be run without having programmatic access to the VBA project (like in http://www.cpearson.com/excel/vbe.aspx)
Thanks!
Jörgen
I am looking for an easy way to check if a macro exists so it doesn't create an error if it isn't there or just ignores the call. The "main" macro is in a workbook that works with a lot of different workbooks, some that contain the "MyMacro" and some don't. And if it exists it should be run...
I tried
On Error Resume Next
Call ActiveWorkbook.Sheets("StartSheet").MyMacro
And if it doesn't exist, I end up with:
"Run-time error '438':
Object doesn't support this property or method"
Any ideas that doesn't require scanning through all macros of the workbook? It needs to be run without having programmatic access to the VBA project (like in http://www.cpearson.com/excel/vbe.aspx)
Thanks!
Jörgen