Hello
Which command determines whether a document is active? The goal would be to leave my program if there is none.
Thank you for your help:)
Hello
Which command determines whether a document is active? The goal would be to leave my program if there is none.
Thank you for your help:)
Hello
You should use activedoc:
http://help.solidworks.com/2012/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISldWorks~ActiveDoc.html
It returns NULL if no documents are active.
Set swModel = swApp.ActiveDoc
If isnull(swModel) then ...
Or maybe:
Do
Set swModel = swApp.ActiveDoc
Loop while isnull(swModel) = false
The function always returns the same thing when a doc is opened or not. I use the code below :
Dim swmodel As SldWorks.ModelDoc2
If IsNull(swmoddel) = False Then Exit Sub
Try to get inspired by this macro then:
http://www.lynkoa.com/tutos/import-export-formats-neutres/macro-solidworks-obtenir-le-nom-des-documents-ouverts