Some additional information
1. This error happens when I'm debugging ONLY when Analysis Toolpak and Analysis Toolpak - VBA are installed/activated as well.
2. Queuing another macro to do the select DOES work. What were you thinking there?
3. If I run Excel and use the packed/deployed xll file, even with Analysis Tookpak addins activated it hardly ever errors. There is a pattern that triggers it once in a while but I'm not sure. I did the following:
- Open Excel with Analysis addins installed
- Test my code, no problems
- Close my file, add blank file, disable Analysis
- Close blank file
- Open my file, enable Analysis
- Run my code - error happens
But if I have analysis addins installed and close and open my file as much as I want to and run code (or simply enable/disable analysis addins without closing my file), no errors.
4. Select is my extension, but error happens before that so don't think it is involved, but this is my code.
public static ExcelReference Select( this ExcelReference reference )
{
var workbookName = reference.WorkbookName();
var sheetName = reference.SheetName();
XlCall.Excel( XlCall.xlcActivate, workbookName );
XlCall.Excel( XlCall.xlcWorkbookActivate, sheetName );
XlCall.Excel( XlCall.xlcSelect, reference );
return reference;
}
5. Given info about Analysis, you still want small sample? Do you have a small 'empty' template that is modifiable or should I just create a new addin on my own?
Thanks.