Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Mark, This code will keep your UserForm on top of all other forms. Add a VB Module to your project and copy the code below into it. CALLING THE MACRO In the UserForm Activate event code module insert the following... KeepFormOnTop Code ------------------- Private Declare Function SetWindowPos _ Lib "user32.dll" _ (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 'Returns the Window Handle of the Active Window Public Declare Function GetActiveWindow _ Lib "user32.dll" () As Long Public Sub KeepFormOnTop() Dim hWnd As Long Const HWND_NOTOPMOST = -2 Const HWND_TOPMOST = -1 Const SWP_NOMOVE = &H2 Const SWP_NOSIZE = &H1 hWnd = GetActiveWindow() SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, _ SWP_NOMOVE + SWP_NOSIZE End Sub ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=49561 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Leith,
Thanks very much for your help. That is exactly what I want to know. Have a great holiday. Mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Userform access on multiple excel files?? | Excel Programming | |||
why do word documents show up on excel and access file menu? | Excel Discussion (Misc queries) | |||
Access from add_in userform to main template userform.... | Excel Programming | |||
VB UserForm to MS Access | Excel Programming | |||
How to show a userform using excel macro in multipage | Excel Programming |