Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
Bonjour.
Pas sûr d'avoir bien compris.
Essaye de rajouter ça dans le module de uf1.
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
End Sub
Alain CROS.
"Jean-François Aubert" <à a écrit dans le message de news:
Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
Bonjour.
Pas sûr d'avoir bien compris.
Essaye de rajouter ça dans le module de uf1.
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
End Sub
Alain CROS.
"Jean-François Aubert" <àOterjfaubert@bluewin.ch> a écrit dans le message de news:
3fbfaf98_3@news.bluewin.ch...
Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
Bonjour.
Pas sûr d'avoir bien compris.
Essaye de rajouter ça dans le module de uf1.
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
End Sub
Alain CROS.
"Jean-François Aubert" <à a écrit dans le message de news:
Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
Salut Alain,
Oui, tu as tout à fait compris et vu juste.
Ta suggestion est exactement ce qu'il me manquait.
Merci beaucoup.
Complément d'info pour ceux que cela intéresse:
- On a un UserForm non-modal,
créé par le code issu de:
http://www.excelabo.net/xl/userforms.php#usfnonmodal
- on utilise un événement UserForm_QueryClose,
(événement se déclenchant à la fermeture de l'UserForm)
- on clique sur son bouton de réduction.
- on clique sur son bouton de fermeture,
l'événement UserForm_QueryClose se déclenche,
dans notre cas, il rend visible un Label (question posée à l'utilisateur)
et 2 CommandButton <OUI> et <NON> à cliquer au choix,
mais l'UserForm est toujours réduit, sous forme de bare au bas de l'écran,
il est alors impossible de voir ce qu'affiche l'UserForm et de cliquer un bouton,
si l'utilisateur n'a pas restauré l'UserForm.
Il faudrait que l'UserForm se restaure à sa taille d'origine,
avec l'événement UserForm_QueryClose.
C'est ici qu'intervient le code proposé par Alain Clos.
Ci-après, la procédure d'Excelabo, complétée du code d'Alain:
'**************************************
Private Declare Function FindWindowA Lib _
"user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"user32" (ByVal hwnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"user32" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hwnd As Long
hwnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) Or &H20000
' ici les
' TextBox1.Visible=True
' etc...
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
' ... ici les
' TextBox1.Visibleúlse
' CommandButton1.Visible=True
' etc...
End Sub
'****************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
"Alain CROS" a écrit dans le message de
news:%Bonjour.
Pas sûr d'avoir bien compris.
Essaye de rajouter ça dans le module de uf1.
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
End Sub
Alain CROS.
"Jean-François Aubert" <à a écrit dans le message de news:Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
Salut Alain,
Oui, tu as tout à fait compris et vu juste.
Ta suggestion est exactement ce qu'il me manquait.
Merci beaucoup.
Complément d'info pour ceux que cela intéresse:
- On a un UserForm non-modal,
créé par le code issu de:
http://www.excelabo.net/xl/userforms.php#usfnonmodal
- on utilise un événement UserForm_QueryClose,
(événement se déclenchant à la fermeture de l'UserForm)
- on clique sur son bouton de réduction.
- on clique sur son bouton de fermeture,
l'événement UserForm_QueryClose se déclenche,
dans notre cas, il rend visible un Label (question posée à l'utilisateur)
et 2 CommandButton <OUI> et <NON> à cliquer au choix,
mais l'UserForm est toujours réduit, sous forme de bare au bas de l'écran,
il est alors impossible de voir ce qu'affiche l'UserForm et de cliquer un bouton,
si l'utilisateur n'a pas restauré l'UserForm.
Il faudrait que l'UserForm se restaure à sa taille d'origine,
avec l'événement UserForm_QueryClose.
C'est ici qu'intervient le code proposé par Alain Clos.
Ci-après, la procédure d'Excelabo, complétée du code d'Alain:
'**************************************
Private Declare Function FindWindowA Lib _
"user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"user32" (ByVal hwnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"user32" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hwnd As Long
hwnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) Or &H20000
' ici les
' TextBox1.Visible=True
' etc...
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
' ... ici les
' TextBox1.Visibleúlse
' CommandButton1.Visible=True
' etc...
End Sub
'****************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
"Alain CROS" <Personne@ICI> a écrit dans le message de
news:%23fjoE7asDHA.684@TK2MSFTNGP09.phx.gbl...
Bonjour.
Pas sûr d'avoir bien compris.
Essaye de rajouter ça dans le module de uf1.
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
End Sub
Alain CROS.
"Jean-François Aubert" <àOterjfaubert@bluewin.ch> a écrit dans le message de news:
3fbfaf98_3@news.bluewin.ch...
Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
Salut Alain,
Oui, tu as tout à fait compris et vu juste.
Ta suggestion est exactement ce qu'il me manquait.
Merci beaucoup.
Complément d'info pour ceux que cela intéresse:
- On a un UserForm non-modal,
créé par le code issu de:
http://www.excelabo.net/xl/userforms.php#usfnonmodal
- on utilise un événement UserForm_QueryClose,
(événement se déclenchant à la fermeture de l'UserForm)
- on clique sur son bouton de réduction.
- on clique sur son bouton de fermeture,
l'événement UserForm_QueryClose se déclenche,
dans notre cas, il rend visible un Label (question posée à l'utilisateur)
et 2 CommandButton <OUI> et <NON> à cliquer au choix,
mais l'UserForm est toujours réduit, sous forme de bare au bas de l'écran,
il est alors impossible de voir ce qu'affiche l'UserForm et de cliquer un bouton,
si l'utilisateur n'a pas restauré l'UserForm.
Il faudrait que l'UserForm se restaure à sa taille d'origine,
avec l'événement UserForm_QueryClose.
C'est ici qu'intervient le code proposé par Alain Clos.
Ci-après, la procédure d'Excelabo, complétée du code d'Alain:
'**************************************
Private Declare Function FindWindowA Lib _
"user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"user32" (ByVal hwnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"user32" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hwnd As Long
hwnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) Or &H20000
' ici les
' TextBox1.Visible=True
' etc...
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
' ... ici les
' TextBox1.Visibleúlse
' CommandButton1.Visible=True
' etc...
End Sub
'****************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}
"Alain CROS" a écrit dans le message de
news:%Bonjour.
Pas sûr d'avoir bien compris.
Essaye de rajouter ça dans le module de uf1.
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ShowWindow GetActiveWindow, SW_RESTORE
End Sub
Alain CROS.
"Jean-François Aubert" <à a écrit dans le message de news:Bonsoir,
J'utilise un UserForm non-modal créé par la méthode Du Grand chef à Plumes LL ci-dessous.
J'ai un événement UserForm_QueryClose.
Quand l'UserForm à été réduit par son bouton de réduction,
et que le bouton de fermeture est cliqué par la suite,
je désire qu'il se restaure à sa taille d'origine,
afin que l'utilisateur puisse traiter l'action du QueryClose
(des CommandBouton de l'UserForm).
Comment puis-je faire ceci ?
PS: j'ai essayé la propriété UserForm.StartUpPosition au début du QueryClose,
mais, merdum, rien à faire.
Merci
'****************************
Option Explicit
Private Declare Function FindWindowA Lib _
"User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib _
"User32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare Function GetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib _
"User32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Uf1.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
'************************************
--
Amicalement
Jean-François Aubert
{Vaudois de la Côte Lémanique}