CATIA VBA 允许在 .CATScript 中使用 "Scripting.Dictionary"

CATIA VBA Enable use of "Scripting.Dictionary" in .CATScript

当 运行ing 一个 .CATScript,其代码是从 VBA 环境中复制的,并且当 运行 在 VBA 环境中按预期运行时,我收到以下错误:

The scripting engine has reported the following error:

Source: Microsoft VBScript runtime error

Description: Variable is undefined: 'Scripting'

Line: 9

Column: 4

如何让这个脚本使用“Microsoft Scripting Runtime”参考库?

我在 google 上搜索了一下,我相信以下内容可以解决我的问题:

'in original VBA code:
Dim dict As Scripting.Dictionary
Set dict = New Scripting.Dictionary

'To have this work in .CATScript, replace the code above with:
Dim dict
Set dict = CreateObject _
("Scripting.Dictionary")

您的解决方案应该有效。

要能够在 VBA 中使用 "Scripting.Dictionary",请转到工具 -> 参考和 select "Microsoft Scripting Runtime"。