Is it possible to use compiler conditional constants together with the "implements" keyword, where the interface is in an add-in?
I have the following in a class module in my workbook, let's call it book1:
#Const Condition1 = 0 ''will be replaced with 1 when add-in is opened
#if Condition1 then
Implements myAddIn.iInterfaceFoo
#End if
I have the add-in myAddIn listed as a reference (i.e. in Tools -> References...).
I'm successfully using the interface with other classes in the add-in, but now I want to call the interface directly in my workbook book1. As long as the add-in is open, when I compile book1 (i.e. Debug -> Compile VBAProject) it compiles successfully.
However, when I try to compile book1 with the add-in closed, I get the error
Compile error: User-defined type not defined
This is precisely what I'm trying to avoid - otherwise if the add-in is missing (for example on someone else's computer) the spreadsheet itself will still work.