You can get the Window handle by using the FindWindow or GetActiveWindow API
calls.
There are plenty of VB code samples on the web tat use one or other of these
API calls. A google search will find them. So long as the code is not
VB.NET, it should drop into a VBA project more or less unmodified.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
> Ok, so I've got my keyboard hook code working except for one problem, it
> currently hooks all keystrokes not just the ones destined for Word. It
[quoted text clipped - 5 lines]
>
> Any suggestions on how to figure out what the thread id of Word is?
tbannist - 28 Apr 2005 16:58 GMT
> You can get the Window handle by using the FindWindow or GetActiveWindow
> API calls.
Thanks, it turns out it wasn't the thread id that was the problem, for some
reason, I can't hook WH_KEYBOARD_LL on the Word thread, but I can hook
WH_KEYBOARD. Fortunately, WH_KEYBOARD is good enough for me.