Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Eyal.Admon
417 Views, 2 Replies

Open unsaved document (VB.net/VBA)

Hi,

 

TRLD: How can i open a part that was ceated in an assembly bebore saving it?

 

when i create a new part in an assembly with the create button, the file is not created untill i save the part for the first time, so using " oDoc = thisapplication.Documents.open(file path) " won't work since no path exists.

Using the right click button, i can open the part and edit it. how can i open it using VBA/VB.net code?

 

Thanks

 

AlexKorzun
in reply to: Eyal.Admon

To make document visible, you just add a view of it. Similar to:

 

    Dim doc As PartDocument
    Set doc = ThisApplication.Documents(ThisApplication.Documents.Count)
    
    Call doc.Views.Add
Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Eyal.Admon
in reply to: AlexKorzun

Thank you!

I think you misunderstood  what i wanted to do but your comment helped a lot.

this is what i needed (VBA):

 Set oDoc = ThisApplication.ActiveDocument
 Set sSet = oDoc.SelectSet
 Set oDoc2 = sSet.Item(1).Definition.Document
 oDoc2.Views.Add