Attribute VB_Name = "TopMost" Option Explicit 'This library file written by Alex Vallat. Contact me at my homepage at http://www.ByAlexV.co.uk ' 'Call "AlwaysOnTop Me" to make the calling form topmost 'Call "CancelAlwaysOnTop" Me to put it back to normal Private 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 Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 Const SWP_NOSIZE = &H1 Const SWP_NOMOVE = &H2 Public Function AlwaysOnTop(frmTarget As Form) SetWindowPos frmTarget.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE End Function Public Function CancelAlwaysOnTop(frmTarget As Form) SetWindowPos frmTarget.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE End Function