I have an Access 2013 (32 bit) app that I've developed. It contains an export feature to "inject" data into Excel worksheets.
The problem I have is that I've compiled it using a reference to the Microsoft Office 15.0 Object Library and Microsoft Excel 15.0 Object library (Office 2013). When my users install it on their PC and have Office 2010 (which uses the Microsoft Office 14.0 Object Library and Microsoft Excel 14.0 Object library) the application throws an error on start-up and I have to go in manually, open VBA / Tools / References (shows Missing: Microsoft Office / Excel 15.0 Object Library) and set the reference back to Microsoft Office 14.0 Object Library and Microsoft Excel 14.0 Object library.
Works fine if the user has Office 2013 installed but breaks if the user has Office 2010 installed.
I need a way to trap this error and set the references dynamically based on the version of Office they are using.