AnsweredAssumed Answered

New Instance of Solidworks

Question asked by Anjani Ojha on Oct 10, 2012
Latest reply on Oct 10, 2012 by Rajat Jain

Hello Everyone,

 

I have used following code to open Solidworks by VB6 which is working well if I am running the in debugging environment but if i am running it via exe its not working.

 

The error is,getting new instance of Solidworks even if one is already running.

 

 

 

On Error Resume Next

Set swApp = GetObject("", "SldWorks.Application")

 

If swApp.Visible = False Then

 

If Err Then

        Err.Clear

        Set swApp = CreateObject("SldWorks.Application")

        If Err Then

            MsgBox Err.Number & "--> " & Err.Description

            Err.Clear

            Exit Function

        End If

End If

 

swApp.Visible = True

swApp.FrameState = swWindowMaximized

End If

 

Thanks

Outcomes