General discussion

Locked

Automation of Multiple Instances

By danprem ·
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 conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Software Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums