enlever le X dans userform

cmarleau

XLDnaute Nouveau
Bonjour le forum,

JE possède une application et lorsque celui-ci s'ouvre un userform s'active, j'aimerais bien faire disparaiître le X à droite afin que les utilisateurs ne puisse quitter sans utiliser le bouton quitter.

ou tout simplement enlever la barre complète en haut de mon userform

Encore milles mercis pour tous ceux qui nous offrent leurs temps afin de bien nous orienter dans nos projets!

respectueusement
christian
 

cmarleau

XLDnaute Nouveau
oup!1

Oublier mon fichier [file name=userform.zip size=9179]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/userform.zip[/file]
 

Pièces jointes

  • userform.zip
    7.8 KB · Affichages: 25
  • userform.zip
    7.8 KB · Affichages: 26
  • userform.zip
    7.8 KB · Affichages: 25

tontoncarton

XLDnaute Occasionnel
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 FindWindowA Lib 'User32' _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

place ca dans userform_initialize

Dim hWnd As Long
hWnd = FindWindowA('Thunder' & IIf(Application.Version Like '8*', _
'X', 'D') & 'Frame', Me.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) And &HFFF7FFFF


:) @+
 

Eric C

XLDnaute Barbatruc
Bonsoir le forum
Bonsoir cmarleau, bonsoir tontoncarton

Autre code pour supprimer la barre de l'USF :
Code:
Voici le code à copier dans le userform:

Option Explicit
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 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

''''''Pour fermer par Double Click, peux être supprimer''''''
Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Unload Me
End Sub
''''''Pour permettre le déplacement du userform, peux être supprimer''''''
Private Sub UserForm_MouseDown(ByVal Button As Integer _
, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ReleaseCapture
SendMessage FindWindow(vbNullString, Me.Caption), &HA1, 2, 0&
End Sub

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
;)
 

Discussions similaires

D
Réponses
0
Affichages
1 K
Davidc57
D

Statistiques des forums

Discussions
314 450
Messages
2 109 719
Membres
110 551
dernier inscrit
Khyolyanna