Bonjour tous le monde Delirum, Arnaud, Violette,
Voici un code qui fonctionne (un peu comme celui de Arnaud)
Créer un module qui contient:
'Find the Dialog's Window
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
'Get the current window style
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
'Set the new window style
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const WS_SYSMENU = &H80000
Const GWL_STYLE = (-16)
Sub HideCloseButton(oUsrFrm As Object)
Dim hWnd As Long
Dim lStyle As Long
hWnd = FindWindow("ThunderDFrame", oUsrFrm.Caption) 'UserForm
Get the current window style
lStyle = GetWindowLong(hWnd, GWL_STYLE)
'Turn off the System Menu bit
SetWindowLong hWnd, GWL_STYLE, lStyle And Not WS_SYSMENU
End Sub
Dans la userform placer le code suivant:
Private Sub UserForm_Initialize()
HideCloseButton Me
End Sub
@+Robert