This website uses cookies to ensure you get the best experience on our website. By using our website you agree on the following Cookie Policy, Privacy Policy, and Terms Of Use
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swComp As SldWorks.Component2
Sub main()
OnErrorResumeNextSet swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
IfNot swModel IsNothingThenSet swSelMgr = swModel.SelectionManager
Set swComp = swSelMgr.GetSelectedObjectsComponent3(1, -1)
Dim path AsStringIfNot swComp IsNothingThen
path = swComp.GetPathName
Else
path = swModel.GetPathName
EndIfIf path <> ""Then
Shell "explorer.exe /select, " & """" & path & """", vbMaximizedFocus
Else
MsgBox "Model is not saved"EndIfElse
MsgBox "Please open assembly document and select the component"EndIfEndSub
Notifications
Join session by SOLIDWORKS and PDM API expret Artem Taturevych at 3DEXPERIENCE World 2025 on Feb 26 at 08:30 AM CST to explore 10 essential macros for automating drawings, assemblies, custom properties, and more