1

Previously this code for opening and activating(bringing workbook to front) has worked for other builds of Microsoft office, however Microsoft's latest build(16.0.11126.20234) seemed to create a problem with opening an existing excel workbook.

testWorkbook = this.Application.Workbooks.Open(path);
testWorkbook.Activate();

The issue is when launching excel and using an 'Open' method on a workbook:

  1. Excel application launches

  2. The title of on the top of the window changes to the workbook name you are trying to open, however the main body of the window is still the default Excel Home screen( home, options, recent workbooks, templates)

  3. Selecting options or any other item on the splash screen results in the splash screen closing and displays the workbook that was intended to be open

I've tried removing any existing code, and created a new AddIn solution with just the code Microsoft documentation provides for loading and displaying a workbook.

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        Workbook testWorkbook;
        string path = "C:\\Path\\To\\Workbook\\TestingBookOpen.xlsx";
        try
        {
            testWorkbook = this.Application.Workbooks.Open(path);
            testWorkbook.Activate();
        }
        catch (Exception ex){
            string message = ex.Message;
        }
    }

I know there are workarounds including:

  • You can disable the start screen from excel directly.
  • You can click into options and then exit it which will bring the sheet up
  • You can have excel already open and it'll work fine

But I'm looking for a programmatic solution/workaround for when my AddIn launches, and to see whether other's have come across the same problem in Microsoft Office's latest build.

nicholas
  • 2,969
  • 20
  • 39
AaronDev
  • 11
  • 2
  • +1 I also have this issue with my Excel Add-In (and from VBA) as well. It can be reproduced with Workbooks.Add as well. – nicholas Sep 27 '19 at 20:00

0 Answers0