Hi,
I tried to print thisdrawing.modeldocument in a vba sub, but it doesn't work.
Thanks
Peter
Solved! Go to Solution.
Solved by matt_jlt. Go to Solution.
Hi Peter,
I'm not sure if you want to print the document name or the actual model document.
To get the model name (from a drawing) the code is as follows:
VBA
Public Sub GetDrawingModelName() ' Get reference to the first referenced document Dim oDoc As Document Set oDoc = ThisApplication.ActiveDocument.ReferencedDocuments.Item(1) ' Get file system object Dim Fso As New FileSystemObject Debug.Print Fso.GetFileName(oDoc.FullFileName) ' Change Debug.Print to be a msgbox or any variable if you want End Sub
If you want to print the actual document let me know an i'll write up something for you.
Regards, Matt.
Hi Matt,
thanks for your quick reply. It's just what I need.
MsgBox ThisApplication.ActiveDocument.ReferencedDocuments.Item(1).FullFileName
Regards
Peter
Be aware that drawing documents can have many separate documents driving difference drawing views.
Offset 1 is just the first view the user created. It may not be the primary document you desire.
Thanks Gruff.
I am getting iPropeties from ipt file and table it on the drawing.I'll check there is only one ipt file referenced.