Office 2016 & # 8594; 2013 "compilation error, cannot find project or library"

I just upgraded to Office 2016, which most of my users did not, and I get a new error when users try to run my scripts.

"Compilation error, cannot find project or library"

I looked through the links and it looks like it is trying to link to the "Microsoft Word 16.0 Object Library" and it is not on machines running Office 2013. I don’t see the possibility to change my link to the 2013 version and I don’t know how to provide mine users access to the 2016 link without updating all (now this is not an option).

This error occurs on the first executable line of code.

Set app = Range("A2")
+4
source share
2 answers

You need to enable the Excel 15.0 object library to use Excel.Range ("A2"), for example, or use late binding, as shown below:

  Dim excelApp As object, r as object
  Set excelApp = CreateObject("Excel.Application")
  Set r = excelApp.Range("A2")
+4
source

Office documents referenced by the VBA project. Office applications will work in later versions of Office. When you open them in a later version, they will refer to this later version.

, Office Office, MISSING: Office, , .
, Excel, Excel Word, Office 2016, Office 2013, Excel , Word MISSING:.

, Office, , Office .

+4

Source: https://habr.com/ru/post/1608830/


All Articles