ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
MCMike Campbell29/06/2012

I want to programatically open an existing file that has been selected as part of the code. I'm unclear on how to capture the variables needed for OpenDoc6. Below is a faux snippet that I hope makes my question clear.

Dim swApp                               As SldWorks.SldWorks
Dim swLastSuccessfulSelect              As SldWorks.Component2
Dim swFilename                          As String
Dim swDocType                           As Long
Dim swOpenDocOptions                    As Long
Dim swConfig                            As String
Dim swFileError                         As Long
Dim swFileWarning                       As Long

swFilename = swLastSuccessfulSelect.FileName
swDocType = swLastSuccessfulSelect.DocType
swOpenDocOptions = swLastSuccessfulSelect.OpenDocOptions
swConfig = swLastSuccessfulSelect.Config
swFileError = swLastSuccessfulSelect.FileError
swFileWarning = swLastSuccessfulSelect.FileError

swApp.OpenDoc6 swFilename, swDocType, swOpenDocOptions, swConfig, swFileError, swFileWarning