Macros CATIA的VBA宏在一台计算机上工作,并且不';我不能在另一台计算机上工作

Macros CATIA的VBA宏在一台计算机上工作,并且不';我不能在另一台计算机上工作,macros,catia,Macros,Catia,我不擅长Catia宏,但我写了一个简单的代码,它在我的Catia上工作,但在其他计算机上不工作。 宏是关于从树中删除停用的实体。请帮忙。代码如下: Sub CATMain() Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part 'If Err.Number=0 Then Dim selection1 'As Selection Set selection1 = partDocument1.Sele

我不擅长Catia宏,但我写了一个简单的代码,它在我的Catia上工作,但在其他计算机上不工作。 宏是关于从树中删除停用的实体。请帮忙。代码如下:

Sub CATMain()

Set partDocument1 = CATIA.ActiveDocument

Set part1 = partDocument1.Part

'If Err.Number=0 Then

Dim selection1 'As Selection
Set selection1 = partDocument1.Selection

selection1.Search "CATPrtSearch.PartDesign Feature.Activity=FALSE"

'if no deactivated components then end program
If selection1.Count = 0 Then
MsgBox "No deactivated features."
Exit Sub
Else

'delete all deactivated components then update the part
selection1.Delete
part1.Update
End If

'error handling
'Else
' Msgbox "Not a part document! Open a single part document."
'End If
End Sub

你收到错误信息了吗?在哪一行?你能发布你的帕尔树的截图吗?嗨,代码中没有错误,只是在另一台计算机上,我把混合体锁在了部分基础设施中,我想这就是问题所在。我不知道;我不知道如何解决它。这里也有类似的问题,在这个链接上就这样解决了。但我不知道如何在我的代码中使用它。啊,我明白了。两台机器是否具有相同的可用许可证?是。我在两台计算机上都使用HD2