I'm writing with Word 2000/VBA, and want to have a
modeless UserForm A floating over the document at all
times, accessible for the user. However, when I call
other UserForms (B or C), the first modeless UserForm A
disappears.
Therefore, I wrote code so when user finishes with B or
C, the code calls a .Show function for the original
UserForm A to put it back over the document. In other
words, I want the modeless UserForm to be put back over
the document, but make it transparent to the user, who is
working in the document itself.
** Is there a way to programatically pass the Focus back
to the main Word document after calling a modeless
UserForm? **
Thanks for any tips you can offer.
Chris Johnson
Arete Clinical Systems
Provided the Userform is called from the document interface
you can use below simple API calls to do it for you.
Declare Function GetActiveWindow Lib _
"user32" () As Long
Declare Function SetFocus Lib _
"user32" (ByVal hwnd As Long) As Long
Sub ShowForm()
Dim l As Long
'get window handle
l& = GetActiveWindow()
'show the modeless userform
UserForm1.Show 0
'return handle
SetFocus l&
End Sub
Krgrds,
Perry
"Chris Johnson" <cdjo...@pol.net> schreef in bericht
news:02c401c2ddda$ea09e040$a101...@phx.gbl...