반응형
This is the code to get the active model name in solidworks
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Sub SolidworksStart()
On Error Resume Next
'// Setting up SolidWorks application objects
Set swApp = GetObject(, "SldWorks.Application")
On Error GoTo 0
If swApp Is Nothing Then
MsgBox "Make sure SolidWorks is running.", vbCritical
Exit Sub
End If
'// Get currently active document
Set swModel = swApp.ActiveDoc
If swModel Is Nothing Then
MsgBox "There are no active SolidWorks documents.", vbCritical
Exit Sub
End If
Msgbox swModel.GetTitle
End Sub

반응형
'VBA SOLIDWORK' 카테고리의 다른 글
| Template Program Development #1 (0) | 2025.01.06 |
|---|---|
| 4. SldWorks.CustomPropertyManager 1/2 (0) | 2024.12.27 |
| 이미지 만들기 -SAMPLE (0) | 2024.12.26 |
| Change Dimension Example (VBA) (0) | 2024.12.25 |
| 모델의 Feature Name, Type, ID 및 Dimensions Name, value 가져오기 (0) | 2024.12.25 |