Julian
Tue Jan 22 00:43:24 PST 2008
Thanks Shauna - just what I was looking for!
I'd found something similar elsewhere but was missing the lpClassName,
which, as you demonstrated, was somewhat arbitrary (not like "XLMAIN")
Haven't tried it yet but it looks like it will do the trick perfectly - then
I will be able to do the auto-saving I want *only* when Word is idle...
VMT! Julian
--
Julian I-Do-Stuff
Some Vista stuff, but mostly just Stuff at
http://berossus,blogspot.com
"Shauna Kelly" <ShaunaKelly@SendNoSpamToShaunaKelly.com> wrote in message
news:uxOPmrKXIHA.484@TK2MSFTNGP06.phx.gbl...
> Hi Julian
>
> At the top of the module, add the following:
> Private Declare Function FindWindowByClass Lib "user32" _
> Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As
> Long) As Long
>
>
> When you want the handle, use
>
> Dim lngHWnd as long
>
> lngHWnd = FindWindowByClass("opusapp", 0&)
>
> FWIW, "Opus" was the code name for the first version of Word for Windows.
>
>
> Hope this helps.
>
> Shauna Kelly. Microsoft MVP.
>
http://www.shaunakelly.com/word
>
>
>
> "Julian" <msforums@tiger2.demon.co.uk> wrote in message
> news:uPwI3PFXIHA.5180@TK2MSFTNGP06.phx.gbl...
>>I have some useful code (incl declarations into user32) for checking
>>keyboard events but it needs Word's Window Handle (Word 2002) - Excel 2002
>>has Application.hWnd but there's nothing like that for Word alas.
>>
>> Anyone know how to do this in VBA? (example would be apreciated)
>>
>> Thanks
>>
>> Julian
>>
>> --
>> Julian I-Do-Stuff
>>
>> Some Vista stuff, but mostly just Stuff at
http://berossus,blogspot.com
>
>