我遇到一个问题,我将调用我的Sub BOM_Document_Creator,并且Sub的第一行给我一个错误(随机且不一致)。我检查了每个变量,它们都正确地传递了。这个问题似乎很随机,就像运行一次一样就可以了。下次可能无法再次使用。我没有正确声明变量吗?可能是我在同一地区有发明家和学徒(我不认为这是因为我在其他地方这样做没问题)吗?
Private Sub BOM_Document_Creator(odocapp As InventorApprentice.ApprenticeServerDocument, odocinvent As Inventor.Document, Invent As Inventor.Application, TheProgressBar As Progress_Bar, oApprentice As InventorApprentice.ApprenticeServerComponent)
Dim CompCollectionApp As InventorApprentice.ComponentOccurrences = odocapp.ComponentDefinition.Occurrences