wenn das funktioniert, dann wäre dies durchaus ein Weg.
Hätte man hier nicht einfach einen weiteren Parameter für die Anzeige der Userform einrichten können?
Hätte hätte Fahrradkette. ;-)
Wenn Du ein Fenster generell immer vorne haben willst, dann gibt es dafür in Windows eine API. Mach mal eine neue Datei, füge eine Userform hinzu, kopiere den Code unten in das Codemodul und starte sie (drück F5).
Dann wechsle zu irgendwelchen anderen Fenstern.
Andreas.
PS.: Ich bin die nächsten 2 Wochen in Urlaub, eine Antwort kann eine Weile dauern falls du weitere Fragen hast.
Option Explicit
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const HWND_TOPMOST = -1
#If Win64 Then
Private 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
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
#Else
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
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
#End If
Private Sub UserForm_Activate()
#If Win64 Then
Dim hwnd As LongPtr
#Else
Dim hwnd As Long
#End If
hwnd = FindWindow("ThunderDFrame", Me.Caption)
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub