"R Avery" wrote in message
...
I have Excel checking a file every so often for a particular command,
and whenever it finds a certain command, I want it to bring Excel to the
front and prompt the user.
Similarly, I would like to be able to send Excel to the back whenever
some other command was inside a file.
How could I achieve this? Any help would be appreciated.
It can be done using the win32 API
In a code module declare the function
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal
hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long,
ByVal cy As Long, ByVal Wflags As Long) As Long
then get the Excel Windows handle
Dim Winhandle as Long
Winhandle=Application.Hwnd
Then call the following sub
FloatWindow(Winhandle)
Public Sub Floatwindow(Winhandle As Long)
' -------------------------------------
' This routine makes the window who's
' handle is passed always on top
' -------------------------------------
Dim Wflags As Integer
Wflags = 2 Or 1
Call SetWindowPos(Winhandle, -1, 0, 0, 0, 0, Wflags)
End Sub
Keith
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---