API: How do I check from VBA that SW is not running?

Discussion in 'SolidWorks' started by steve, May 15, 2004.

  1. steve

    steve Guest

    I have some VBA code in Excell. How do I check that SW is alredy open or
    not?
     
    steve, May 15, 2004
    #1
  2. steve

    rocheey Guest

    How do I check that SW is alredy open or not?

    The following snippet will tell you (assuming you DIMmed "swapp"
    to either an Object oi SldWorks.SldWorks. Note that there is an
    empty parameter before "Sldworks.application". If you replace that with
    an empty string, ie, Set swapp = GetObject("", "Sldworks.application"),
    then a new instance of SW will be created if it is not running.



    On Error Resume Next
    Set swapp = GetObject(, "Sldworks.application")
    On Error GoTo 0
    if swapp is nothing then msgbox "Solidworks is not running"
     
    rocheey, May 16, 2004
    #2
  3. steve

    kellnerp Guest

    If you dig around in API help there is a whole section on how to tell if SW
    is running, not running, running silently, etc.
     
    kellnerp, May 16, 2004
    #3
  4. Dim swApp as sldworks.sldworks
    set swApp=sldworks.sldworks
    If not swApp=Nothing Then
    (sw not running!)
    End if
     
    Evan T. Basalik, May 16, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.