I have developed an Excel Add-In in VS that has worked beautifully till this morning. The add-in works fine when you startup Excel normally, and manually load an xslm file the calls a method in the add-in, from the Open menu item. It also works fine debugging in VS - Excel is fired automatically, Add-In is loaded, and can load an xlsm file that calls a method in the Add-In. It also works when running excel from the command line – BUT it you run excel from the command line with the xxxx.xlsm as the parameter, it does not. Same results if I try to fire excel from a C# app using the process.Start() - which is what I need to ultimately do. If I double click on the .xlsm from Windows Explorer, is works fine as well. The error I’m getting is in the VBA function Workbook_Open() in the .xlsm I'm using – it blows when it attempts to access any method from the add-in.
I get the old ‘Object variable or With block variable not set’ when it hits the following line automationobject.Startup or any method in the add-in – it’s like it’s not loading the add-in properly, so it’s not available to call. I've put in automationobject.COMAddIns.Update before I set an object to it, tried some waits as well - to no avail.
Workbook_Open method here:
Any help greatly appreciated!
Bookmarks