Ich habe nach langem Suchen und recherchieren endlich einen Code gefunden wie ich ein UserForm immer in den Vordergrund stellen kann. Jetzt ist nur noch mein Problem dass es auch AKTIV sein soll (mit einem blinkenden Cursor an der entsprechenden Stelle). Ich freue mich über Hilfe :-)
Code im form_Öffnen:
Option Explicit
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
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const GC_CLASSNAMEMSUSERFORM = "ThunderDFrame"
Private Const HWND_TOPMOST = -1
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Sub UserForm_Activate()
Dim hWndForm As Long
hWndForm = FindWindow(GC_CLASSNAMEMSUSERFORM, Me.Caption)
If hWndForm 0 Then SetWindowPos hWndForm, HWND_TOPMOST, 0&, 0&, 0&, 0&, _
SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOACTIVATE Or SWP_SHOWWINDOW
End Sub