Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Excel - Always on top?

2,158 views
Skip to first unread message

Chris Howlett

unread,
Jul 23, 2002, 5:33:45 AM7/23/02
to
Is there a workbook property that will force an Excel workbook to
always remain visible - similar to the "Always on Top" option
available in WinHelp?

Regards

Dave Peterson

unread,
Jul 23, 2002, 6:13:30 PM7/23/02
to
Put this into a general module:

Option Explicit

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 uFlags As Long) As Long

Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2


Sub AlwaysOnTop()

Dim hwnd As Long
Dim res As Long

hwnd = FindWindow("XLMAIN", vbNullString)
res = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, vbNull)

End Sub

Sub NotAlwaysOnTop()

Dim hwnd As Long
Dim res As Long

hwnd = FindWindow("XLMAIN", vbNullString)
res = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, vbNull)

End Sub

========
I also looked at http://www.shareware.com and searched for "always on top".

There were quite a few hits including this one:
http://www.simtel.net/pub/pd/57690.html

========
This was actually more irritating than I would have imagined! I could
resize/minimize, but if you like this kind of thing,....

--

Dave Peterson
ec3...@msn.com

Chris Howlett

unread,
Jul 27, 2002, 11:34:59 AM7/27/02
to
Many thanks for your help, this works a treat!

Dave Peterson <ec3...@msn.com> wrote in message news:<3D3DD50A...@msn.com>...

0 new messages