Excel VBA code equivalent in Word

M

Mohan

Hi

I have already asked this in the Excel workgroup and no
one was able to help me.
May the word experts can...

I can excecute a macro in Excel when the user changes the
window using Application.Onwindow and when the user
presses a specific key on the keyboard using
Application.Onkey methods

Word does not seem to have these Application.Onwindow or
Application.Onkey methods

How do I do the same in Word?

Any help would be appreciated.

Thanks
 
J

Jezebel

You can trap window events by creating a class with a WithEvents reference
to the Word.Application object. That includes the WindowActivate which fires
when the user changes windows. Word has no universal keyboard events.
 
P

Peter Hewett

Hi Mohan

Use the Word Application objects WindowActivate and/or WindowDeactivate
events.

I can't offer you any help with the Onkey, there is no direct Word
equivalent. However, of course you can assign keyboard shortcuts to you
macro/procedure.

HTH + Cheers - Peter
 

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