VBA Macro - Open Document Silently

VBA Macro - Open Document Silently

isocam
Collaborator Collaborator
377 Views
1 Reply
Message 1 of 2

VBA Macro - Open Document Silently

isocam
Collaborator
Collaborator

Can anybody help?

 

Is it possible, using a VBA macro to open an Inventor "Part" (ipt) silently (Hidden), without showing it on the screen and get the Part's "description" property, then close the part?

 

For test purposes only, I want to open a "Part" silently and get the part's description property and show it in a msgbox?

 

 

Many thanks in advance!

 

Kind Regards

 

Darren

 

 

0 Likes
Accepted solutions (1)
378 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor
Accepted solution

Hi @isocam.  Maybe something like this?

 

Sub OpenPartHidden()
    Dim oPDoc As PartDocument
    Set oPDoc = ThisApplication.Documents.Open("C:\Temp\MyPart1.ipt", False) 'False = hidden
    Dim oDescProp As Inventor.Property
    Set oDescProp = oPDoc.PropertySets.Item(3).Item("Description")
    Dim sDesc As String
    sDesc = oDescProp.Value
    Call MsgBox(sDesc, vbOKOnly, "Part Description")
    oPDoc.ReleaseReference
    Call ThisApplication.Documents.CloseAll(True) 'True = unreferenced only
End Sub

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes