You don't even need to play flippity-flop adding and deleting a reference to the Excel type library.

Simply change your object declarations to As Object for your production compile.

You can go ahead and use CreateObject instead of New when creating objects whether you strongly type them on not.

It is the strong typing (and early binding) that causes the compatability issue, not have a reference set.