Learn how 3 ideas from SOLIDWORKS Top Ten List 2020 are implemented from scratch in less than 25 minutes by watching this video
This example displays the message box of the type of the document currently active in SOLIDWORKS. This will work regardless the document is saved or not. IModelDoc2::GetType SOLIDWORKS API method can be used to return the type enumeration which will identify the document as SOLIDWORKS Part, Assembly or Drawing.
Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Sub main() Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc If Not swModel Is Nothing Then Select Case swModel.GetType Case swDocPART: MsgBox "Active document is Part" Case swDocASSEMBLY: MsgBox "Active document is Assembly" Case swDocDRAWING: MsgBox "Active document is Drawing" End Select Else MsgBox "No document opened" End If End Sub