First time poster of this site.... be gentle
I am trying to work in multiple instances of excel, but am having no luck in using vb code in my activated instance. This is my code:
I can send keystrokes to the activated app, but I can't seem to perform any coded functions on it. Instead it just performs the code on the instance that the code resides in.PHP Code:
For Each process In GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_process ")
If process.Name = "EXCEL.EXE" Then
'MsgBox process.Handle
count = 0
hand = process.Handle
AppActivate (hand)
'SendKeys ("{DOWN}"), True
For Each wkb In Workbooks
If Windows(wkb.Name).Visible Then
book(count) = wkb.Name
End If
count = count + 1
Next
End If
Next
MsgBox book(0) & book(1) & book(2) & book(3) & book(4) & book(5) & book(6)
End Sub
Any help would be great..
Thanks.
Bookmarks