Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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! |
#2
![]() |
|||
|
|||
![]()
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! |
#3
![]() |
|||
|
|||
![]()
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! |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I divide a page into three sections? | Microsoft Word Help | |||
When I bring up Word, it comes up minimized. | Microsoft Word Help | |||
saving the workspace | Microsoft Word Help | |||
how do i open multiple documents in one word window? mac word x | Microsoft Word Help | |||
why does my new word xp file window flash and lock up? | Microsoft Word Help |