Trigger an Excel VBA event from another application

M

Mike

I can send a message to a dotNet Textbox and have it trigger the
TextBox_Change event. What I want to do is the reverse. I want to send a
message from dotNet to Excel VBA and have it trigger some event so I can
immediately respond to the event. Since I can't get a Handle for any of the
VBA controls, I'm not having much luck. I can send a message that changes
the Form Caption but this doesn't trigger any event that I can find, and I
want to stay away from a polling technique.

Any ideas would be appreciated.

mike
 
N

NickHK

Mike,
Since you can't get the HWnd, SendMessage is useless.
Can you not use Automation to control Excel ?

NickHK
 
M

Mike

I'm not familiar with Automation. If you could give me just a few more
words, I could start Googlin'.

thanks
 
A

abhimanyu

Mike,

You can call a method in Excel VBA from .NET assembly but you cannot
get an event back in the assembly from VBA code.
If this is what you want to do, get the Primary Interop Assemblies for
Excel, reference them in your .NET project and use the
Excel.Application object. A method named "Run" is used to call a VBA
macro.

regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top