Error on Document.FullDocumentName

Error on Document.FullDocumentName

Anonymous
Not applicable
735 Views
2 Replies
Message 1 of 3

Error on Document.FullDocumentName

Anonymous
Not applicable

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

0 Likes
Accepted solutions (1)
736 Views
2 Replies
Replies (2)
Message 2 of 3

MechMachineMan
Advisor
Advisor
Accepted solution
oRefDoc.FullFileName

should work a little more reliably.

 

Document name appends the LOD.

ie; C:\File.iam <MASTER>

 

FileName is just the base file name

ie; C:\File.iam

 

 

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 3

Anonymous
Not applicable

Never mind, changed it to oRefDoc.FullFileName and it seems to work fine

 

Not sure why I was going through the ComponentDefinition in the first place Smiley Frustrated

0 Likes