View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Coleman John Coleman is offline
external usenet poster
 
Posts: 274
Default How do I get one instance of Excel to communicate with another instance?

Greetings,

Your approach does seem too complicated. If you have both add-ins
installed and your project has references to both add-ins, then code in
your project can invoke procedures from either add-in and thus
coordinate them. You could do a search for "Solver" in this newsgroup
since that is an add-in which is frequently invoked by other code and
some of the code fragments you find might give you an idea of how to
invoke add-ins from VBA.

If you are using the raw code in Evolver (as opposed to using Evolver
as an add-in) then it might be as simple as adding a reference to
Ptestpro to your project with the Evolver code. Go to tools -
references.

Hope this helps. If it doesn't - don't give up. I'd be surprised if you
really need to communicate between difference instances of Excel.

-John Coleman

p.s. What is Evolver? Sounds like a genetic algorithm optimization
tool.

wrote:
I want to run 2 versions of Excel that communicate with each other.
This seems unusual, but let me explain why:

I have purchased a addin called "Evolver" which I want to run a macro
that runs another addin (that I've also purchased) called "Ptestpro".
"Ptestpro" has a menu that it adds to Excel.

The problem is that Excel does not seem to allow this. One addin
cannot run another addin, not even by sending keystrokes (using
"sendkeys") to the menu of the other addin.

So the only solutions I can think of a
1. copy all the code of "Ptestpro" to a spreadsheet that is being
processed by "Evolver". (I am unclear as to whether this would help)
2. Run two instances of Excel, one of which has the "Evolver" addin,
the other which has the "PtestPro" addin. Evolver in one instance
would send a message to run "Ptestpro" in the other instance. When
"Ptestpro" is done, Ptestpro writes an answer to a cell in its instance
of Excel. This answer would have to be retrieved somehow by the Excel
running "Evolver".
so this breaks down to three parts:
a) Excel1 runs a macro in Excel2
b) Excel1 waits for Excel2 to finish running the macro
b) Excel 1 retrieves a value from a cell in Excel2

My question is, is this the way to go, and if so, what the code look
like?

Or is this a too complicated way of solving this problem?
Thanks,
HA