Hi,
Need a macro to open a reference part from part file.
Check this image below :
I have recorded the macro to get the codes, But if you see each time part files name will vary I can't use the recorded code.
FYR:
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("Part1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
Part.EditInContext
' Open
Set Part = swApp.OpenDoc6("C:\Part1.SLDPRT", 1, 0, "", longstatus, longwarnings)
Set Part = swApp.ActiveDoc
End Sub
Please help to get the right code to open the document
SolidworksApi/macros