Hi Craig,
OK - I think I can get to a problem with the 32-bit version of Excel
2013 under very particular steps.
Some sequences that cause no problems I could see:
(All the testing is with the .dna file I pasted in the earlier reply
on this thread)
1. If I double-click the .xll, everything is fine.
2. If I select the .xll from the Recent Files list, everything is
fine.
3. If I open Excel, then select 'Open Other Workbooks', then select
the .xll from the Recent Workbooks, everything is fine.
4. If I open Excel, then press Escape, then select File->Open,
Computer, Browse and pick the .xll, everything is fine.
5. If I add the add-in to the Add-Ins list, everything is fine every
time I start Excel.
The only way I can cause a problem is this:
* Open Excel, immediately select 'Open Other Workbooks', then
Computer, Browse and select the .xll. This causes my Excel to has some
repainting problem. I can press Ctrl+N to get a new workbook that will
work, but the ribbon is totally broken, Excel doesn't resize etc.
Pressing Ctrl+N again gets me a new Excel window where things work
fine. The broken Excel window is still at the back, and can be closed
with Ctrl+F4.
Is this consistent with what you see?
To speculate:
Perhaps Excel-DNA is trying to get the Application object before the
Excel ribbon and main window has been initialized, and this attempt
confuses the new Excel's initialization of the ribbon and window
chrome.
Regards,
Govert
On Jan 24, 10:08 pm, csm <
cmillsh...@gmail.com> wrote:
> Thanks for your work, Govert.
>
> My experience in using the sample project above is if the xll is started
> through the addin dialog, it can get the application object even though no
> workbook is open. So it doesn't seem to jibe with:
>
> *The case where no workbook is open is special, since Excel has
>
> > not initialised the COM object model yet.*
>
> I think the reason that the addin dialog approach works is because if you
> open the xll through the back-stage view from Options, Excel leaves the
> backstage view and shows the Excel desktop (ribbon view) when the xll is
> selected, even without a workbook being open. If you do file...open
> approach from backstage, the Open File dialog pops up but in the background
> the backstage view is still present so the ribbon isn't shown. So perhaps
> the issue isn't just a workbook being open but if not, the desktop must be
> showing and not the backstage.
>
> I must deal with this in another Excel SDI project and so use the
> application handle and windows API calls to determine if backstage or
> desktop (ribbon) window is showing. That is the only way I could solve
> that issue.
>
> That is the path I was trying with ExcelDNA. If a workbook wasn't open and
> the desktop wasn't showing, I was hoping to not start the the ribbon
> somehow. It would be ugly and a bad workaround but it beats crashing Excel.
>
> I would be happy with something like an override on ExcelRibbon.New() where
> I can tell yes or no to start, or an ExcelDNA property to essentially "turn
> off" the addin internally because no workbook is open. That would come in
> handy for licensing scenarios too where an addin could be turned off if not
> a valid license.
>
> I hope you can find something.
>
> Best,