Adding a reference RRS feed

  • Question

  • I use VB from Visual Studio 2015.  I have installed MS Office 2016. In the references I can see 'Microsoft Excel 16.0 object library', but when I try to add it, I get the message "A reference to Microsoft Excel 16.0 object library could not be added. What am I miussing?
    Wednesday, June 27, 2018 7:02 PM

All replies

  •  Sounds to me like you might be having a 32bit/64bit problem.  For example, you may have installed the (x86) 32bit version of MS Office and your application is targeting a (x64) 64bit OS,  or maybe visa-versa.

     You can try changing your application to target the (x86) 32bit platform.  You can do that in your application's properties page,  on the Compile tab as seen below...


     Main point being,  make sure you target the same version as the MS Office version you installed.

    If you say it can`t be done then i`ll try it

    Wednesday, June 27, 2018 8:02 PM
  • Thanks for the suggestion.  I tried all 3 options (x86, x64, AnyCpu) without success.  Any other suggestions?
    Wednesday, June 27, 2018 8:43 PM
  • Hi

    This reason may be installed before the office installed. Net framework,I think you can try the following three methods:

    1.Simple, direct "Project" - "Add Reference..." - "Browse" - to "C:\Windows\Assmbly" - Select "Microsoft.Office.Interop.Word" - "Confirm";Add "using Word = Microsoft.Office.Interop.Word;"

    2.At the VS command prompt, cd to "C:\Windows\Assmbly\GAC\Microsoft.Office.Interop.Word\ 71e9bce111e9429c",Run " regasm Microsoft.Office.Interop.Word.dll"

    3.The worst way to reinstall Office

    Best Regards


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, June 28, 2018 2:09 AM
  • Thanks for the suggestion.  I tried all 3 options (x86, x64, AnyCpu) without success.  Any other suggestions?

    While you won't get Intellisense you may want to try using late binding and CreateObject instead. There is an example using Excel at the below link:

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, June 28, 2018 6:00 PM
  • You'll probably need to use VS2017 and VSTO or use late binding as Paul suggests.  I don't think that VSTO for VS2015 is going to work for Office 2016.  I think you'd be better served using VS2017 anyway...

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Friday, June 29, 2018 1:07 PM