[Solved] Share Excel.Application executable among multiple WSF processes?


Usage of GetObject() is documented in this old KB article. Error handling is required to get the first instance created. Like this:

Dim excel
On Error Resume Next
Set excel = GetObject(, "Excel.Application")
If Err.number = 429 Then
   Set excel = CreateObject("Excel.Application")
End If
If Err.number <> 0 Then
    WScript.Echo "Could not start Excel: " & err.Description
    End
End If
'' etc

However, seeing zombie Excel.exe processes surviving is a broad concern, it strongly suggests that the scripting runtime is not exiting normally. Perhaps error handling in your existing scripts is less than ideal, that’s not likely to get better when you slam a single instance with multiple scripts. Excel does get pretty cranky when it cannot keep up. Using the OpenXML api or Excel Services are the better way to go about it.

1

solved Share Excel.Application executable among multiple WSF processes?