--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com ch...@cpearson.com
"jo" <jerome...@bcd-microtechnique.com> wrote in message
news:0b5b01c2c6e3$fbda51a0$d4f82ecf@TK2MSFTNGXA11...
Please tell us in detail.....
Thanks
>.
>
2. Start Excel again.
That will give you two instances of Excel. You can run a macro in each one.
But, the instances won't be able to communicate with each other. In other
words, a macro in Instance #1 can't work with a workbook that's open in
Instance #2.
John Walkenbach
For Excel tips, macros, & downloads...
http://j-walk.com/ss
"sudhendra" <acli...@yahoo.com> wrote in message
news:02dd01c2c701$f9228900$d2f82ecf@TK2MSFTNGXA09...
Depends.
Create D:\tmp\foo.xls and D:\tmp\bar.xls. Then insert a general VBA module in
foo.xls containing
Sub foo()
Dim wkb As Object
Set wkb = GetObject("D:\tmp\bar.xls")
MsgBox _
wkb.Worksheets("Sheet1").Range("A1").Address(0, 0, xlA1, 1) & _
Chr(13) & wkb.Worksheets("Sheet1").Range("A1").Value
wkb.Worksheets("Sheet1").Range("A2").Value = "A present from " & _
ThisWorkbook.FullName
Set wkb = Nothing
End Sub
and insert a general VBA module in bar.xls containing
Sub bar()
Dim wkb As Object
Set wkb = GetObject("D:\tmp\foo.xls")
MsgBox _
wkb.Worksheets("Sheet1").Range("A1").Address(0, 0, xlA1, 1) & _
Chr(13) & wkb.Worksheets("Sheet1").Range("A1").Value
wkb.Worksheets("Sheet1").Range("A2").Value = "A present from " & _
ThisWorkbook.FullName
Set wkb = Nothing
End Sub
Now open each workbook in a separate application instance, and run their
respective macros. Seems like they can be interconnected to some extent, no? For
that matter, both instances can use wkb.Application.Run to run macros in the
other workbook in the other application instance. All that seems not be be
allowed is simultaneous 'circular' OLE client-server linking, but it's possible
to switch control back and forth using [pseudo]semaphores and
Do While CheckSemaphore : Yield : Loop
constructs in macros in both files to coordinate execution. I suppose it'd be
possible to use API calls to create less ad hoc IPC conduits, but I haven't
tried doing that sort of thing in Windows.
--
Public Service Announcement
Don't attach files to postings in nonbinary newsgroups like this one.