General discussion
August 6, 2002 at 02:27 PM
danprem

Automation of Multiple Instances

by danprem . Updated 24 years, 1 month ago

I am trying to write a program which will perform similar tasks over (already running)multiple instances of a client object connected to diffrent server.

To start up, I tried starting up multiple instances of Excel and then using the following code to link them to an array of objects in my program.

do while SessionCount <= 4 BringWindowToTop lngHwnd(SessionCount) SetActiveWindow lngHwnd(SessionCount) On Error Resume Next Set gdtpTEmp(SessionCount) =GetObject(, "EXCEL.Application") If Err.Number <> 0 Then
Set gdtpTEmp(SessionCount) = CreateObject(“EXCEL.Application”)
End If
On Error GoTo 0
SessionCount = SessionCount + 1
Loop

here lngHwnd is an array of the window handles of the Excel Instances.

The problem is that even though I set active window for each instance, All the object in my program point only to the first Instance.

Does anyone have any Idea how to assign multiple instances to objects in the program? Is it Possible?

This discussion is locked

All Comments