SendMessage to VBA UserForm control?

R

rgutter

Hi,

I thought I had a simple IPC mechanism in place for passing messages
to/from both a VB6 app and code running within Word. I set up a
separate controller EXE that first receives messages to register the
window handles of an invisible textbox in each app, and then uses
SendMessage to the textboxes, whose Change event handlers then respond
change the applications' states.

You probably know what I discovered. VBA UserForm controls are
windowless. I can use GetActiveWindow to return a handle by setting
focus to UserForm textbox, but that handle apparently becomes invalid
once VBA code outside the form resumes.

Does anyone have any suggestions on how to use SendMessage to anything
within the VBA environment that can respond upon changing? Or is the
paradigm useless within an Office app?

Thanks.
 
J

Jezebel

Various ways; but meaningless to discuss without context. What are you
actually trying to do?
 
R

rgutter

Fairly straightforward. I have a VB6 app that calls a Word macro - I'm
trying to keep the Word app invisible, so the question is how to allow
the user to abort it. (They can't really do it via the VB6 app, since
it's waiting on completion.)

So I have a separate controller application running with a single Abort
button that sends a message to either app (depending on which is
active). VB6 has an invisible textbox control that receives the
message; its Change event then sets a flag that causes its processing
to branch to a cleanup-and-end routine. I'm trying to do the same with
the Word VBA code, so I created a dummy UserForm and textbox, only to
find that the controller has no valid textbox window handle to send an
equivalent message to.
 

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