How to delete specific OLE (3rd Party) object using Ilogic.

How to delete specific OLE (3rd Party) object using Ilogic.

caroline_ccc
Enthusiast Enthusiast
478 Views
2 Replies
Message 1 of 3

How to delete specific OLE (3rd Party) object using Ilogic.

caroline_ccc
Enthusiast
Enthusiast

Hello. I would like your help .

How to delete only one specific OLE reference from an IPT file? 

It has 2  3rd Party  PDF reference and want to delete only one. 

 

I`m using below code, but it deletes all files.  but I want to delete only item (A.pdf)

 

Dim oDoc As Inventor.Document
 Dim ref As Inventor.ReferencedOLEFileDescriptor
 oDoc = ThisApplication.ActiveDocument
 For Each ref In oDoc.ReferencedOLEFileDescriptors
    ref.Delete 'delete reference
 Next  

 

carolineccc_1-1637153156385.png

 

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

JelteDeJong
Mentor
Mentor
Accepted solution

does this work for you?

Dim oDoc As Inventor.Document
oDoc = ThisApplication.ActiveDocument
For Each ref As ReferencedOLEFileDescriptor In oDoc.ReferencedOLEFileDescriptors
    If (ref.DisplayName = "A.pdf") Then
        ref.Delete() 'delete reference
    End If
Next

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

caroline_ccc
Enthusiast
Enthusiast
Many thanks @JelteDeJong.
It works perfectly. 🙂
I was trying to reference as Item(x) but it didn't work. With ref.DisplayName works well.
Appreciate your help!
0 Likes