View Single Post
  #3   Report Post  
bh
 
Posts: n/a
Default

Thanks! I was able to implement a workaround with FindWindow. The trick was
that there are multiple Word windows open at the time, so I had to first get
the window title from ActiveDocument.Name + " - Microsoft Word".
Still, it's awfully crazy to have such power with an Object, yet have to go
to such lengths for a basic operation.

Does anyone know if there's a Application, Document, or Window method that
would push it to front?

bh


"AA2e72E" wrote:

Try (in a module):

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
Long) As Long
Sub FL()
Dim lHandle As Long
lHandle = FindWindow("OpusApp", vbNullString)
If 0 lHandle Then SetForegroundWindow (lHandle)
End Sub


"bh" wrote:

I've actually done a lot of Mailmerge related driving of Word for years using
OLE, but the one nagging problem is there does not seem to be a method
equivalent to Windows' SetForegroundWindow().
Our app's users really don't want to have to click the taskbar after already
starting a merge. Is there an undocumented Application method to do this?
Or a property where I can get the window handle?
Thanks!