我们的管理员运行了一些 MS Office 2016 更新(内部版本 11929.20838),突然间我注意到我之前编写的一个 Excel VBA 宏中出现了一些意外错误。例如下面的错误是针对我没有明确定义的任何变量弹出的。以前不是这样,除非我提到了 Option Explicit,否则我从未经历过这样的事情。
编译错误:找不到项目或库
对于我的代码的以下 2 个语句,我也遇到了相同的错误,而它在上次 Microsoft Office 2016 更新之前运行平稳。
' Against the following two declarations, the compiler is highlighting
' Date in parenthesis and quoting same error "Can't find project or library"
xMonth = VBA.DateTime.Month(Date)
xYear = VBA.DateTime.Year(Date)
' And showing same error as above against defining an Array variable like below
srchString = Array("invoice_number", "invoice_date", "Category_wise_code", "Bill To Customer", "consignees_address_long")
'And even here, it is giving the same error:
[A1].Font.Bold = True
有谁知道这些错误以及如何解决这个问题?这一切都出乎意料。让我告诉你这个宏已经使用了 4 年多了,我从来没有遇到过这样的问题。
虽然不是所有的链接都打开了,但谷歌窗口正在简要显示一些人也面临宏崩溃的情况。
感谢您花时间阅读我的帖子。