I would really appreciate some pointers as I have run into something where I clearly don't understand enough about Excel.
I have now reduced the problem to the following
---- orignal question ----
I have library code / classes that are successfully used in several Access based projects but one is generating an Error 91 object error when used in Excel.
The code creates a separate Excel instance (via a global variable gXapp - excuse the ugliness) then opens an input file. In Access this works fine, but in Excel I get an error when exiting the OpenXbook function that returns an Excel.Workbook.
If you step through the code, you can see the Excel instance in Windows Task Mgr, then the file contents in the Excel instance that is visible, then error as you exit the function.
I've even tried dropping the gXapp and altering OpenXbook to use Application.Workbook.Open and still the same problem.