The solution I found is on the Tomas Vasquez Sites.
DISABLING THE CLOSE BUTTON OF A USERFORM IN VBA
This is the code:
Option Explicit
' Fonte: Tomas Vasquez Sites
'
' http://www.tomasvasquez.com.br/blog/microsoft-office/vba/desabilitando-o-botao-fechar-de-um-userform-no-vba
'==========================================================================
' Retira o botão "X" (fechar) do Formulário, permanecem a barra e o caption
'==========================================================================
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) _
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_Initialize()
Dim hwnd As Long
hwnd = FindWindowA(vbNullString, Me.Caption)
SetWindowLongA _
hwnd, -16, _
GetWindowLongA(hwnd, -16) And &HFFF7FFFF
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim hwnd As Long
hwnd = FindWindowA(vbNullString, Me.Caption)
SetWindowLongA _
hwnd, -16, _
GetWindowLongA(hwnd, -16) Or &H80000
End Sub
Private Sub ButtonSair_Click()
Unload Me
End Sub
The form needs a close button in this case.
I removed the sign sorry for the misunderstanding. @leo
– rubStackOverflow
Thank you! Thank you.
– Leo
It seems you have two questions of your own with the same title. @leo
– rubStackOverflow
I realized, I just removed, grateful once again.
– Leo