Open unsaved document (VB.net/VBA)

Open unsaved document (VB.net/VBA)

Eyal.Admon
Contributor Contributor
456 Views
2 Replies
Message 1 of 3

Open unsaved document (VB.net/VBA)

Eyal.Admon
Contributor
Contributor

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

 

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

AlexKorzun
Autodesk
Autodesk
Accepted solution

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.

0 Likes
Message 3 of 3

Eyal.Admon
Contributor
Contributor

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

 

0 Likes