This is a symptom specifically when compiling an Excel VBA project. The following error occurs:
User-defined type not defin
I had the same issue, if you enable Microsoft Scripting Runtime you should be good. You can do so under tools > references > and then check the box for Microsoft Scripting Runtime. This should solve your issue.