Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hi @filippo.costantin3HZMT.  If you just need to open the document so you can read or edit its iProperty, then close it again, there is an easier, and more logical way to do that.

Instead of:

 

Call AddComponent(file)

 

...use this:

 

Dim oFileDoc As Document = ThisApplication.Documents.Open(file, False)

 

...then, instead of this:

 

Call DeleteComponent()

 

 ...use this:

 

oFileDoc.Close(True) 'True = skip save

 

Or, instead of the oFileDoc.Close, you might also be able to use the following routine:

 

oFileDoc.ReleaseReference

 

...but then, after the end of the loop, if you used the ReleaseReference method, you can use this:

 

ThisApplication.Documents.CloseAll(True) 'True  = only close all unreferenced documents

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)