this code would keep a form on top of all other windows in excel 2010, but in excel 365 it does not work (using 64bit)
thanks for the help
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Private Declare PtrSafe Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10
' Summary: Keeps a UserForm, or any window on top of all other windows.
' Call this macro from the UserForm_Activate event code module.
' Returns the Window Handle of the Window
' that is accepting User input.
Private Declare PtrSafe Function GetForegroundWindow Lib "user32.dll" () As Long
Private Declare PtrSafe 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
thanks for the help
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Private Declare PtrSafe Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10
' Summary: Keeps a UserForm, or any window on top of all other windows.
' Call this macro from the UserForm_Activate event code module.
' Returns the Window Handle of the Window
' that is accepting User input.
Private Declare PtrSafe Function GetForegroundWindow Lib "user32.dll" () As Long
Private Declare PtrSafe 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