Linking Office Programs with VBA
Posted on 2014-02-16
I have an application written in MSAccess 2010. It is a large and complex application and it works fine. I distribute this application with the MSAccess runtime environment. This environment only contains the Access runtime engine and no additional MS Office software.
I have a user request to add a feature to dynamically create an MSExcel spreadsheet with data from the application. To include this feature I have to link the Microsoft Excel 14.0 object library so that calls to Excel.Application, and all the workbook, sheet, and cell functionality can be used.
The problem that I have is that if I include this library, then the software won't run on machines that have NO excel installed, even if I don't use this functionality. It is just a matter of the dynamic linking at load time. Even more so, if the user has excel 2007, 2003, or any other than 2010, the code won't load either.
So, what I'm looking for is a way to handle load time errors, just like I can handle runtime errors with an "on error" statement. If I can handle these load time errors, then I can add conditional code that will allow calls to the appropriate routines if needed/allowed/desired.
Anybody have a clue?