In need to use the FindWindow API function to return a hWnd handle to the
window that Word is currently running in. I am unsure of two things...
1\ In Office 2000, Word's class name is "OpusApp".
Is it the same name in Word 97 ?
2\ The second argument for FindWindow requires a string containing the
text that appears in the Caption of the application's window.
I am currently using code below, however my knowledge of Word is
somewhat limited. Could someone please tell me if I can rely on the
following code to always return the exact string ? In Word 97 too ?
TIA,
Vic Eldridge
Sub CaptionString()
Dim CaptionString As String
If Application.ActiveWindow.Caption = "" Then
CaptionString = Application.Caption
Else
CaptionString = Application.ActiveWindow.Caption & _
" - " & Application.Caption
End If
MsgBox CaptionString
End Sub
Sub CaptionString()
Dim CaptionString As String
If Application.Windows.Count > 0 Then
If Application.ActiveWindow.Caption = "" Then
CaptionString = Application.Caption
Else
CaptionString = Application.ActiveWindow.Caption & _
" - " & Application.Caption
End If
Else
CaptionString = Application.Caption
End If
MsgBox CaptionString
End Sub
"Victor Eldridge" <v...@ultratrace.com.au> wrote in message
news:3d0f...@news.bekkers.com.au...
> In need to use the FindWindow API function to return a hWnd handle to the
> window that Word is currently running in. I am unsure of two things...
>
> 1\ In Office 2000, Word's class name is "OpusApp".
> Is it the same name in Word 97 ?
Yes
> 2\ The second argument for FindWindow requires a string containing the
> text that appears in the Caption of the application's window.
> I am currently using code below, however my knowledge of Word is
> somewhat limited. Could someone please tell me if I can rely on the
> following code to always return the exact string ? In Word 97 too ?
You don't need to specify the second argument for FindWindow - you can use:
hwnd_Word = FindWindow("OpusApp", vbNullString)
--
Hope this helps.
ibby
Please post replies or follow-ups to the **newsgroup** so that participants
may benefit or contribute.
FindWindow("OpusApp", vbNullString) appears to return a handle to the most
recently activated instance, which is exactly what I need.
The word "Opus" sounds intriguing doesn't it ?
I wonder what the story is behind that...
"ibby" <ib...@bigpond.net.au> wrote in message
news:usDaVGtFCHA.2280@tkmsftngp12...
"Victor Eldridge" <v...@ultratrace.com.au> wrote in message
news:3d10...@news.bekkers.com.au...
Heeeeeere Opus, Opus Opus Opus, Heeeeeere Opus...
"Guy Gallo" <noEmailATmsn.com> wrote in message
news:Oe6UZz6FCHA.2652@tkmsftngp13...