Show every instance of Word?

E

Ed

Every now and then, I get a flash of a small Word window that looks like
it's left over from running a macro program (in the program, I deliberately
set the Word window to about 3 inches square and parked it off to the side).
Is there a way to get a Word macro to show me every instance of Word, even
if not visible?

As a side question, would it be possible for this instance of Word to get
"caught" somewhere, and persist or reopen after Restarts and Shut Downs? I
am using Word 2000 and Windows 2000.

Ed
 
K

Karl E. Peterson

Ed said:
Every now and then, I get a flash of a small Word window that looks
like it's left over from running a macro program (in the program, I
deliberately set the Word window to about 3 inches square and parked
it off to the side). Is there a way to get a Word macro to show me
every instance of Word, even if not visible?

Sure. Will take a bit of hand-tuning, but the basic idea would be to:

*** call EnumWindows,

http://vb.mvps.org/samples/FindPart


*** watch for those with a classname of "OpusApp",

Private Declare Function GetClassname Lib "user32" Alias "GetClassNameA" (ByVal
hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

Private Function Classname(ByVal hWnd As Long) As String
Dim nRet As Long
Dim Class As String
Const MaxLen As Long = 256

' Retrieve classname of passed window.
Class = String$(MaxLen, 0)
nRet = GetClassname(hWnd, Class, MaxLen)
If nRet Then Classname = Left$(Class, nRet)
End Function


*** call ShowWindow to make visible.

Private Declare Function IsWindowVisible Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal
nCmdShow As Long) As Long

Private Const SW_HIDE = 0
Private Const SW_SHOW = 5

Public Function WindowVisible(ByVal hWnd As Long, Optional NewValue) As Boolean
' Attempt to affirm, if user specified a new setting.
If Not IsMissing(NewValue) Then
If CBool(NewValue) Then
Call ShowWindow(hWnd, SW_SHOW)
Else
Call ShowWindow(hWnd, SW_HIDE)
End If
End If
' Return current visibility.
WindowVisible = IsWindowVisible(hWnd)
End Function

As a side question, would it be possible for this instance of Word to
get "caught" somewhere, and persist or reopen after Restarts and Shut
Downs? I am using Word 2000 and Windows 2000.

Sounds unlikely to the point of impossible, no.
 

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