I ended up copying some code that keeps the form on top of windows. This in a module
Public Declare PtrSafe Function SetWindowPos _
Lib "user32" ( _
ByVal hwnd As LongPtr, _
ByVal hwndInsertAfter As LongPtr, _
ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) _
As Long
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Then depending on my needs in the program, I can set it so it does or doesn't stay on top.
this in my code:
Dim xStype As Long
Dim xHwnd As LongPtr
xStype = HWND_TOPMOST
Call SetWindowPos(Application.hwnd, xStype, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE)
and this:
xStype = HWND_NOTOPMOST
Call SetWindowPos(Application.hwnd, xStype, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE)
Works like a charm
. Thanks for your suggestions. You are far above me with Excel.