Open Excel Add-in, and no blank workbook by default

Jul 29, 2013 at 9:27 PM
Hi,

We programed Excel Add-in on DNA. After installing, Open Excel and a blank workspace without any workbook is shown. By default, a blank workbook should be shown.

After clicking new a blank workbook, BOOK2 is created and could not find where is the BOOK1?

Anyone has the similar problems?

thanks,

Sherry
Coordinator
Jul 30, 2013 at 8:41 AM
Hi Sherry,

I'm not sure why you are not getting a blank workbook when opening Excel.
Are you perhaps double-clicking the .xll file? - In that case I don't expect to see a blank workbook.

If you've installed the add-in into the Add-Ins list (Alt+t, i) and it loads automatically, I'd still expect the blank book at startup.

The fact that the first book you open is not called BOOK2 is due to Excel-DNA sometimes loading and closing a workbook behind the scenes, in order to ensure the Excel COM Automation object model is initialized. This is required if you have a ribbon or CTP, or you access the ExcelDnaUtil.Application object in your startup. Apart from the issue with the name, I don't know of this having other side effects, nor do I know of a workaround to not load the extra workbook. This should not close a book that Excel opened, so should not interfere with the first issue you raise.

Regards,
Govert
Jul 30, 2013 at 1:27 PM
Thanks for your reply, Govert.

The add-ins (menu ribbon and backstage) are installed in Add-ins list and the weird thing is for Debug mode, it works well and a blank workbook is loaded at startup but with title BOOK2. For release mode, it always startup with a blank workspace without any workbook.

You are right, we do have ExcelDnaUtil.Application object in AutoOpen. For the BOOK2 title, is it possible to force to rename it to BOOK1 at startup?

Regards,

Sherry
Aug 3, 2013 at 9:04 PM
Edited Aug 3, 2013 at 11:12 PM
I am getting a Book2 workbook with my addin compiled in both Release and Debug mode.
Perhaps need to be careful in releasing all objects created as ExcelDnaUtil.Application
But should Book1 show itself as another process in the Task Manager? I see only one Excel.exe there.
Ismail

Update: I can not get to Book1 whatever I tried. It will be good to know how we can either switch to Book1 or rename Book2 as Book1.
Coordinator
Aug 4, 2013 at 8:35 AM
Edited Aug 4, 2013 at 8:36 AM
Getting Book2 is normal and expected.
Excel-DNA will open and close a workbook if it needs to get hold of the Application object while loading. This causes Excel to call the next book that gets opened Book2.

I know of no workaround.

-Govert
Aug 4, 2013 at 12:26 PM
Thanks Govert. That's fine.
As long as I know this is not happening because of me :)
Thanks for this excellent tool again.
I'll try to donate some money as soon as my financial situation gets a little better. I've got two kids in college :)
Ismail

Ismail