Bonsoir
Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup
Alpha
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
docmarti
Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas. Merci beaucoup Alpha
Bonjour.
Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Empêche l'utilisation du Bouton de fermeture
If CloseMode = vbFormControlMenu Then
MsgBox "Le Bouton de fermeture est désactivé."
Cancel = True
End If
End Sub
"Alpha" <Alpha@ducentaure.fr> wrote in message
news:uPJvNUowDHA.1364@tk2msftngp13.phx.gbl...
Bonsoir
Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup
Alpha
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas. Merci beaucoup Alpha
Alpha
Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
Merci beaucoup Docmarti,
cela fonctionne très bien,
une p'tite dernière peut-on supprimer la barre de titre
d'un userform ?
Alpha
-----Message d'origine-----
Bonjour.
Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Empêche l'utilisation du Bouton de fermeture
If CloseMode = vbFormControlMenu Then
MsgBox "Le Bouton de fermeture est désactivé."
Cancel = True
End If
End Sub
"Alpha" <Alpha@ducentaure.fr> wrote in message
news:uPJvNUowDHA.1364@tk2msftngp13.phx.gbl...
Bonsoir
Je désire interdire la fermeture d'un userform par la
croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci
ne fonctionne pas.
Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
michdenis
Bonjour Alpha,
Dans ton formulaire :
'Section déclaration API à mettre dans le haut de ton module formulaire
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long ' Pour pouvoir déplacer l'UserForm avec clic gauche maintenu Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function ReleaseCapture Lib "user32" () As Long Private Declare Function EnableWindow Lib "user32" _ (ByVal hWnd As Long, ByVal fEnable As Long) As Long
Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub
Salutations!
"Alpha" a écrit dans le message de news:1416501c3c31a$359ec730$ Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
Bonjour Alpha,
Dans ton formulaire :
'Section déclaration API à mettre dans le haut de ton module formulaire
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
' Pour pouvoir déplacer l'UserForm avec clic gauche maintenu
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function EnableWindow Lib "user32" _
(ByVal hWnd As Long, ByVal fEnable As Long) As Long
Private Sub UserForm_Initialize()
Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption)
Style = GetWindowLong(hWnd, -16) And Not &HC00000
SetWindowLong hWnd, -16, Style
DrawMenuBar hWnd
End Sub
Salutations!
"Alpha" <Alpha@ducentaure.fr> a écrit dans le message de news:1416501c3c31a$359ec730$a601280a@phx.gbl...
Merci beaucoup Docmarti,
cela fonctionne très bien,
une p'tite dernière peut-on supprimer la barre de titre
d'un userform ?
Alpha
-----Message d'origine-----
Bonjour.
Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Empêche l'utilisation du Bouton de fermeture
If CloseMode = vbFormControlMenu Then
MsgBox "Le Bouton de fermeture est désactivé."
Cancel = True
End If
End Sub
"Alpha" <Alpha@ducentaure.fr> wrote in message
news:uPJvNUowDHA.1364@tk2msftngp13.phx.gbl...
Bonsoir
Je désire interdire la fermeture d'un userform par la
croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci
ne fonctionne pas.
'Section déclaration API à mettre dans le haut de ton module formulaire
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long ' Pour pouvoir déplacer l'UserForm avec clic gauche maintenu Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function ReleaseCapture Lib "user32" () As Long Private Declare Function EnableWindow Lib "user32" _ (ByVal hWnd As Long, ByVal fEnable As Long) As Long
Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub
Salutations!
"Alpha" a écrit dans le message de news:1416501c3c31a$359ec730$ Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
docmarti
Bonjour Alpha.
Je cite la réponse donnée par Michel Pierron:
Il t'en couteras l'utilisation de quelques fonctions API. Dans le module de ton UserForm:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub
Bien évidemment, tu ne pourras plus dans ce cas déplacer ton UserForm avec la souris.
"Alpha" wrote in message news:1416501c3c31a$359ec730$ Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
Bonjour Alpha.
Je cite la réponse donnée par Michel Pierron:
Il t'en couteras l'utilisation de quelques fonctions API.
Dans le module de ton UserForm:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As
Long
Private Sub UserForm_Initialize()
Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption)
Style = GetWindowLong(hWnd, -16) And Not &HC00000
SetWindowLong hWnd, -16, Style
DrawMenuBar hWnd
End Sub
Bien évidemment, tu ne pourras plus dans ce cas déplacer ton UserForm avec
la souris.
"Alpha" <Alpha@ducentaure.fr> wrote in message
news:1416501c3c31a$359ec730$a601280a@phx.gbl...
Merci beaucoup Docmarti,
cela fonctionne très bien,
une p'tite dernière peut-on supprimer la barre de titre
d'un userform ?
Alpha
-----Message d'origine-----
Bonjour.
Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Empêche l'utilisation du Bouton de fermeture
If CloseMode = vbFormControlMenu Then
MsgBox "Le Bouton de fermeture est désactivé."
Cancel = True
End If
End Sub
"Alpha" <Alpha@ducentaure.fr> wrote in message
news:uPJvNUowDHA.1364@tk2msftngp13.phx.gbl...
Bonsoir
Je désire interdire la fermeture d'un userform par la
croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci
ne fonctionne pas.
Il t'en couteras l'utilisation de quelques fonctions API. Dans le module de ton UserForm:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub
Bien évidemment, tu ne pourras plus dans ce cas déplacer ton UserForm avec la souris.
"Alpha" wrote in message news:1416501c3c31a$359ec730$ Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
Alpha
Merci beaucoup Denis Alpha
"michdenis" a écrit dans le message de news:
Bonjour Alpha,
Dans ton formulaire :
'Section déclaration API à mettre dans le haut de ton module formulaire
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
' Pour pouvoir déplacer l'UserForm avec clic gauche maintenu Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long Private Declare Function EnableWindow Lib "user32" _ (ByVal hWnd As Long, ByVal fEnable As Long) As Long
Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub
Salutations!
"Alpha" a écrit dans le message de news:1416501c3c31a$359ec730$
Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
Merci beaucoup Denis
Alpha
"michdenis" <michdenis@hotmail.com> a écrit dans le message de news:
uejV7DywDHA.1196@TK2MSFTNGP12.phx.gbl...
Bonjour Alpha,
Dans ton formulaire :
'Section déclaration API à mettre dans le haut de ton module formulaire
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA"
_
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA"
_
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As
Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As
Long
' Pour pouvoir déplacer l'UserForm avec clic gauche maintenu
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function EnableWindow Lib "user32" _
(ByVal hWnd As Long, ByVal fEnable As Long) As Long
Private Sub UserForm_Initialize()
Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption)
Style = GetWindowLong(hWnd, -16) And Not &HC00000
SetWindowLong hWnd, -16, Style
DrawMenuBar hWnd
End Sub
Salutations!
"Alpha" <Alpha@ducentaure.fr> a écrit dans le message de
news:1416501c3c31a$359ec730$a601280a@phx.gbl...
Merci beaucoup Docmarti,
cela fonctionne très bien,
une p'tite dernière peut-on supprimer la barre de titre
d'un userform ?
Alpha
-----Message d'origine-----
Bonjour.
Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Empêche l'utilisation du Bouton de fermeture
If CloseMode = vbFormControlMenu Then
MsgBox "Le Bouton de fermeture est désactivé."
Cancel = True
End If
End Sub
"Alpha" <Alpha@ducentaure.fr> wrote in message
news:uPJvNUowDHA.1364@tk2msftngp13.phx.gbl...
Bonsoir
Je désire interdire la fermeture d'un userform par la
croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci
ne fonctionne pas.
'Section déclaration API à mettre dans le haut de ton module formulaire
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
' Pour pouvoir déplacer l'UserForm avec clic gauche maintenu Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long Private Declare Function EnableWindow Lib "user32" _ (ByVal hWnd As Long, ByVal fEnable As Long) As Long
Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub
Salutations!
"Alpha" a écrit dans le message de news:1416501c3c31a$359ec730$
Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
Alpha
Merci beaucoup Docmarti Alpha
"docmarti" a écrit dans le message de news: #
Bonjour Alpha.
Je cite la réponse donnée par Michel Pierron:
Il t'en couteras l'utilisation de quelques fonctions API. Dans le module de ton UserForm:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub
Bien évidemment, tu ne pourras plus dans ce cas déplacer ton UserForm avec la souris.
"Alpha" wrote in message news:1416501c3c31a$359ec730$ Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.
Merci beaucoup Alpha
.
Merci beaucoup Docmarti
Alpha
"docmarti" <docmarti@spam.net> a écrit dans le message de news:
#tI4LJywDHA.1680@TK2MSFTNGP12.phx.gbl...
Bonjour Alpha.
Je cite la réponse donnée par Michel Pierron:
Il t'en couteras l'utilisation de quelques fonctions API.
Dans le module de ton UserForm:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA"
_
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As
Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As
Long
Private Sub UserForm_Initialize()
Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption)
Style = GetWindowLong(hWnd, -16) And Not &HC00000
SetWindowLong hWnd, -16, Style
DrawMenuBar hWnd
End Sub
Bien évidemment, tu ne pourras plus dans ce cas déplacer ton UserForm avec
la souris.
"Alpha" <Alpha@ducentaure.fr> wrote in message
news:1416501c3c31a$359ec730$a601280a@phx.gbl...
Merci beaucoup Docmarti,
cela fonctionne très bien,
une p'tite dernière peut-on supprimer la barre de titre
d'un userform ?
Alpha
-----Message d'origine-----
Bonjour.
Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Empêche l'utilisation du Bouton de fermeture
If CloseMode = vbFormControlMenu Then
MsgBox "Le Bouton de fermeture est désactivé."
Cancel = True
End If
End Sub
"Alpha" <Alpha@ducentaure.fr> wrote in message
news:uPJvNUowDHA.1364@tk2msftngp13.phx.gbl...
Bonsoir
Je désire interdire la fermeture d'un userform par la
croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci
ne fonctionne pas.
Il t'en couteras l'utilisation de quelques fonctions API. Dans le module de ton UserForm:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub
Bien évidemment, tu ne pourras plus dans ce cas déplacer ton UserForm avec la souris.
"Alpha" wrote in message news:1416501c3c31a$359ec730$ Merci beaucoup Docmarti, cela fonctionne très bien, une p'tite dernière peut-on supprimer la barre de titre d'un userform ? Alpha
-----Message d'origine----- Bonjour. Voici qui devrait fonctionner.
Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) ' Empêche l'utilisation du Bouton de fermeture If CloseMode = vbFormControlMenu Then MsgBox "Le Bouton de fermeture est désactivé." Cancel = True End If End Sub
"Alpha" wrote in message news:
Bonsoir Je désire interdire la fermeture d'un userform par la croix
j'ai récupéré une proc sur Excelabo.net, mais celle-ci ne fonctionne pas.