For several years I've used a sheet that calls a macro in a macro module from the ThisWorkbook module under Spreadsheet objects.
Earlier this week I adjusted an unrelated part of the macro module, and the call from the ThisWorkbook module stopped working. It now reports the macro module function as "Undefined function or value", instead of running it. So I set up a very simple test spreadsheet to figure out the problem, and I can't make it work there either.
Here is my test code, which doesn't work right now.
Code in Spreadsheet Objects > ThisWorkbook:
REM ThisWorkbook Module
Private Sub Workbook_NewSheet(ByVal sh As Object)
TestFunction()
End Sub
Code in Macro Modules > Macro:
Sub TestFunction()
ActiveSheet.Cells(1,1).Value = "'Test"
End Sub
The error reported is "Undefined function or value: TESTFUNCTION" when it is called from Workbook_NewSheet(ByVal sh As Object)
I have also tried putting call in front of TestFunction(), removing the brackets (with or without call), changing the TestFunction() declaration to public, and some other variations as well - but what's here right now (with no call, and with the empty brackets) is what had been working before.
Where is the problem?