GetObject() not telling me when the COM application is already running 
Author Message
 GetObject() not telling me when the COM application is already running

GetObject( , "class") is not seeing my application when it is already
running.

I am using Excel 2000 in Windows 2000 professional.

In my script, GetObject() always returns a 429 and then creates a new
version using CreateObject. Here is my code to see if an application (my
own) is running-

=================================
    ' try to locate reference to running application
    Dim SigApp As Object
    On Error Resume Next
    Set SigApp = GetObject(, "Foobar.Application")
    If (Err.Number = 429) Then
        ' create a new Foobar object
        On Error GoTo ERR_OUT
        Set SigApp = CreateObject("Foobar.Application")
    ElseIf (Err.Number <> 0) Then
        ' report any other type of error
        MsgBox "Error: " & Err.Description
        Exit Sub
    End If

=================================

All help is appreciated,

Thanks,

   - Chuck

--
Chuck Gebben

EDX Engineering, Inc.



Tue, 12 Aug 2003 03:23:29 GMT  
 GetObject() not telling me when the COM application is already running
Chuck,

This may be of help. In the O'Reilly's VB & VBA in a Nutshell it mentions that
you can't use GetObject to obtain a reference to a class created with Visual
Basic. To instantiate a class crated with VB use CreateObject.

HTH,

Simon

Quote:
-----Original Message-----

GetObject( , "class") is not seeing my application when it is already
running.

I am using Excel 2000 in Windows 2000 professional.

In my script, GetObject() always returns a 429 and then creates a new
version using CreateObject. Here is my code to see if an application (my
own) is running-

=================================
    ' try to locate reference to running application
    Dim SigApp As Object
    On Error Resume Next
    Set SigApp = GetObject(, "Foobar.Application")
    If (Err.Number = 429) Then
        ' create a new Foobar object
        On Error GoTo ERR_OUT
        Set SigApp = CreateObject("Foobar.Application")
    ElseIf (Err.Number <> 0) Then
        ' report any other type of error
        MsgBox "Error: " & Err.Description
        Exit Sub
    End If

=================================

All help is appreciated,

Thanks,

   - Chuck

--
Chuck Gebben

EDX Engineering, Inc.

.



Tue, 12 Aug 2003 17:41:06 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How can I tell if a program is already running

2. How can I tell if a program is already running

3. To GetObject or Not to GetObject

4. How to check is application is already running...

5. If application already running

6. Q: How do I Determine if a Specific Application is Already Running

7. application is already running - help

8. Unload application if already running

9. Req: Unload application if already running

10. How can I check if Access application is running already

11. Testing for an application already running

12. If application already running

 

 
Powered by phpBB® Forum Software