Could some one help me with understanding why this is erroring and what I can do to fix it? I tried leaving it out, but everytime I try to use the add-in it just crashes.
This is taken directly from the Solidworks API Help, but there is no explenation is swdocPART is a place holder, or if it is different in newer versions of Visual Studio.
And I am at a loss on how to fix this, nor can I locate any posts really covering this.
SolidworksApi macrosImports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports SolidWorks.Interop
Module OpenPrt
Dim swApp As SldWorks
Dim swModel As ModelDoc2
Dim swSelMgr As SelectionMgr
Dim swDocSpecification As DocumentSpecification
Dim sName As String
Dim longstatus As Long, longwarnings As Long
Dim Control1 As UserControl1
Dim sLocation As String
Sub OpenStrtPrt()
swApp = New SldWorks
sLocation = Control1.StartParts1.SelectedValue
swDocSpecification = swApp.GetOpenDocSpec(sLocation)
sName = swDocSpecification.FileName
swDocSpecification.DocumentType = swDocPART
swDocSpecification.ViewOnly = False
swDocSpecification.Silent = True
swModel = swApp.OpenDoc7(swDocSpecification)
longstatus = swDocSpecification.Error
longwarnings = swDocSpecification.Warning
End Sub
End Module