GetObject does not work with Excel 2016 RRS feed

  • Question

  • The following code works fine on my Windows 10 64 computer, running Visual Basic 2013 and Excel 2010

            Dim oExcel As Excel.Workbook = Nothing

            oExcel = GetObject(path + filename)

            oExcel.Application.Visible = True

            oExcel.Windows(1).Visible = True

    However, when I run the same code after having installed Office 2016, when the filename workbook is not opened, it opens two Excel windows, which are blank  (no worksheets are displayed) and unresponsive. They have to be closed ending the task in Task Manager. 

    The code throws an error message saying index out of range, which is due to Windows.Count being 0.

    When the filename workbook is open before running the code, the GetObject does connect with the instance of the workbook and it can proceed with the workbook operations (although, some become very slow).

    I have added to my project the Microsoft Office 16 and Microsoft Excel 16 references, removing the Office 14 and Excel 16 previous references. 

    Please I need help to solve this problem that has become a big bottleneck for me.

    Many thanks.

    Friday, July 22, 2016 9:28 AM

All replies

  • Hi,

    Using your code, I get the same error.

    Modify your code: add shell method to run Excel.exe then get the instance

    Shell("C:\Program Files (x86)\Microsoft Office\Office16\Excel.exe",




            Dim oExcel As Excel.Workbook = Nothing

            Shell("C:\Program Files (x86)\Microsoft Office\Office16\Excel.exe",


            oExcel = GetObject("C:\Users\Administrator\Desktop\test.xlsx")

            oExcel.Application.Visible = True

            oExcel.Windows(1).Visible = True


    Or another simple method to open workbook

            Dim xlApp As Object

            xlApp = CreateObject("Excel.Application")

            xlApp.Visible = True



    Tuesday, July 26, 2016 5:39 AM
  • Hibari,

    Thank you for confirming that you get the same error.

    Yes, I have been using the CreateObject and Workbooks.Open methods as workarounds.

    The important thing here is that the GetObject method is not working. I have reported the bug. Is there anything else that we can do? How likely is it to get resolved soon?

    Additionally, the performance of Excel 2016 with Visual Basic is very poor. My routine takes no more than 2 secs with Excel 2010 and over 1 minute, sometimes 2 minutes, with Excel 2016. Additionally, Excel 2016 crashes often when doing simple cell operations.

    Tuesday, July 26, 2016 8:27 AM
  • Hi AntSalc,

    >> I have reported the bug. Is there anything else that we can do? How likely is it to get resolved soon?

    Thanks for your reporting. And your patience would be appreciated.

    If this is an urgent issue, I will suggest you contacting the Microsoft professional support so that our engineers can work closely with you to troubleshoot this issue.

    If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. Please visit the below link to see the various paid support options that are available to better meet your needs.;en-us;offerprophone

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 27, 2016 6:34 AM
  • I encountered the same problem but seems like System.Runtime.InteropServices.GetActiveObject("Excel.Application") works fine.
    Thursday, March 2, 2017 11:01 PM
  • One year on and I am still waiting for Microsoft to fix this. Neither Bob Archer nor anybody else at Microsoft has contacted me again since an email from Bob  in August 2016 .
    • Edited by AntSalc Sunday, August 6, 2017 3:01 PM
    Sunday, August 6, 2017 2:49 PM
  • Use:

             Set exapp = GetObject(, "Excel.Application")
             Set exworkb = exapp.workbooks("name.xlsm")

    Thursday, January 17, 2019 1:50 PM
  • This issue is not fixed yet.

    Getobject still does not work with Excel 2016.

    Anybody has any solution?


    • Edited by AntSalc Friday, February 8, 2019 1:53 PM
    Thursday, February 7, 2019 9:14 AM