Live-Forum - Die aktuellen Beiträge
Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

UserForm

Forumthread: UserForm

UserForm
20.09.2005 13:59:41
Erich
Hallo....
Eine Frage zu diesem Code
Option Explicit
'Deklaration: Globale Form API-Konstanten
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_NOSIZE As Long = &H1
Private Const HWND_TOPMOST As Long = -1&
Private Const HWND_NOTOPMOST As Long = -2&
'Deklaration: Globale Form API-Funktionen
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 Sub CommandButton1_Click()
Unload Me
End Sub


Private Sub UserForm_Activate()
SetWindowPos Application.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + _
SWP_NOSIZE
AppActivate Me.Caption
'End Sub


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
SetWindowPos Application.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + _
SWP_NOSIZE
End Sub

Bei Windows 2000 kommt Fehlermeldung.
Bei Windows XP einwandfrei.
Vorab schon mal ein Dankeschön
Gruss Erich
Anzeige

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: UserForm
20.09.2005 14:02:41
MichaV
Hallo,
welche Fehlermeldung? Funzt es bei XP in Excel?
Gruss- Micha
PS: Rückmeldung wäre nett.
AW: UserForm
20.09.2005 14:07:26
Erich
hallo Micha
Laufzeitfehler 438
Objekt unterstützt diese Eigenschaft oder Methode nicht!
Gruss Erich
AW: UserForm
20.09.2005 15:00:22
MichaV
Hallo Erich,

Option Explicit
'Deklaration: Globale Form API-Konstanten
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_NOSIZE As Long = &H1
Private Const HWND_TOPMOST As Long = -1&
Private Const HWND_NOTOPMOST As Long = -2&
'Deklaration: Globale Form API-Funktionen
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
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
Dim hwnd As Long
hwnd = FindWindow(vbNullString, Me.Caption)
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + _
SWP_NOSIZE
AppActivate Me.Caption
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim hwnd As Long
hwnd = FindWindow(vbNullString, Me.Caption)
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + _
SWP_NOSIZE
End Sub

Gruss- Micha
PS: Rückmeldung wäre nett.
Anzeige
Suuuuuper
20.09.2005 15:11:48
Erich
Hallo Micha
Vielen Dank für den Code.
Läuft absolut perfekt.
Gruss Erich
Danke für Deine Rückmeldung . owT
20.09.2005 17:37:21
MichaV
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige