VBA 'set typelib = createobject("scriptlet.typelib")' 权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45082258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 12:54:07  来源:igfitidea点击:

VBA 'set typelib = createobject("scriptlet.typelib")' Permission Denied

excelvbaexcel-vba

提问by JAtterton

I have a problem with my code which seems to have cropped up over night. There are some peculiarities with this so I'll try to give as much detail as I can.

我的代码有问题,似乎是一夜之间突然出现的。这有一些特点,所以我会尽量提供尽可能多的细节。

The file in question is an excel workbook which generates an xml file from data passed in. The file is opened, populated and saved via a macro, and this section runs fine.

有问题的文件是一个 Excel 工作簿,它根据传入的数据生成一个 xml 文件。该文件通过宏打开、填充和保存,这部分运行良好。

The problem occurs when creating a GUID for the .xml, in this routine:

在此例程中为 .xml 创建 GUID 时出现问题:

Function GenGUID() As String

Dim strGUID As String
Dim TypeLib As Object

Set TypeLib = CreateObject("Scriptlet.TypeLib")
strGUID = TypeLib.guid

'dump the curly brackets
strGUID = Replace(strGUID, "{", "")
strGUID = Replace(strGUID, "}", "")

strGUID = Left(strGUID, Len(strGUID) - 2)

GenGUID = strGUID

End Function

Specifically, the line:

具体来说,该行:

Set TypeLib = CreateObject("Scriptlet.TypeLib")

This throws up a "Runtime error 70: Permission Denied".

这会引发“运行时错误 70:权限被拒绝”。

Now, the peculiarities.

现在,特点。

  • Out of 4 machines the file was tried on, it works on one of them.
  • The user of the 'working' machine has tried running the file on the other 3 machines to no avail.
  • Of the 3 'broken' machines, 2 had updates installed overnight and the other hadn't had updates installed in a few days. The 'working' machine hasn't had updates installed since February.
  • The administrator account has tried running the file to rule out an overnight permissions update.
  • The file ran fine yesterday (12th Jul 2017) on one of the 'broken' machines.
  • All reference libraries have been checked and they match with the 'working' machine.
  • The Excel version in use on all 4 machines is 2013 Pro.
  • 在 4 台机器上尝试了该文件,它在其中一台上工作。
  • “工作”机器的用户尝试在其他 3 台机器上运行该文件但无济于事。
  • 在 3 台“损坏”的机器中,有 2 台在一夜之间安装了更新,而另一台在几天内没有安装更新。自二月以来,“工作”机器尚未安装更新。
  • 管理员帐户已尝试运行该文件以排除夜间权限更新。
  • 该文件昨天(2017 年 7 月 12 日)在其中一台“损坏的”机器上运行良好。
  • 所有参考库都经过检查,它们与“工作”机器匹配。
  • 所有 4 台机器上使用的 Excel 版本都是 2013 Pro。

The stand out above is the updates issue. But, the machine the file ran fine on yesterday was the 'broken' machine not updated overnight, ruling this out.

上面最突出的是更新问题。但是,昨天文件运行良好的机器是“损坏的”机器,没有在一夜之间更新,排除了这一点。

We have tried everything we can think of, along with a lot of internet trawling for answers. All coming up with nothing.

我们已经尝试了所有我们能想到的方法,并在互联网上搜索了大量的答案。一切都来不及了。

Does anyone have any ideas?

有没有人有任何想法?

Thanks in advance for any help.

在此先感谢您的帮助。

采纳答案by James Veldman

We ran into this problem this morning too.

今天早上我们也遇到了这个问题。

Delete Windows update KB3213624. That solved the error.

删除 Windows 更新 KB3213624。这解决了错误。

回答by tony722

The KB3213624 seems to be the Office 2010 Security Update. Below are the KBs for other versions of MS Office:

KB3213624 似乎是 Office 2010 安全更新。以下是其他版本的 MS Office 的知识库:

Microsoft Office 2013 Service Pack 1 (64-bit editions)      3213555 
Microsoft Office 2013 Service Pack 1 (32-bit editions)      3213555 
Microsoft Office 2007 Service Pack 3                        3213640
Microsoft Office 2016 (32-bit edition)                      3213545
Microsoft Office 2010 Service Pack 2 (32-bit editions)      3213624 
Microsoft Office 2010 Service Pack 2 (64-bit editions)      3213624
Microsoft Office 2013 RT Service Pack 1                     3213555
Microsoft Office 2016 (64-bit edition)                      3213545

回答by JAtterton

We've now resolved our issue.

我们现在已经解决了我们的问题。

It was caused by updates, apparently. After rolling back the last batch of updates on all 'broken' machines we now have 4 'working' machines.

显然,这是由更新引起的。在所有“损坏”机器上回滚最后一批更新后,我们现在有 4 台“工作”机器。