
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When looping through all the referenced document of an assembly I occasionally get this error:
Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
The error is generated on the line of code:
oPath = oRefDoc.ComponentDefinition.Document.FullDocumentName
Is there another way to access the full file path of the document that's guaranteed to work EVERY time. Re-starting Inventor generally solves the issue, but then it will pop up again soon after.
My code goes like this:
' Get the active assembly.
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
' Get all of the referenced documents.
Dim oRefDocs As DocumentsEnumerator
oRefDocs = oAsmDoc.AllReferencedDocuments
' Iterate through the list of documents.
Dim oRefDoc As Document
' Iterate through all referenced documents beneath the active assembly
For Each oRefDoc In oRefDocs
' Get filepath of document
'Dim oPath As String
'Try
' Get filepath of document
oPath = oRefDoc.ComponentDefinition.Document.FullDocumentName
'MsgBox("Success")
'Catch
'MsgBox("Fail")
'End Try
Next
Solved! Go to Solution.