I found the solution on a national website and adapted it.
The reference I took as the basis for the form without the title bar (called by header on the site) was from: Saber Excel.
Excel spreadsheet vba userform without header
I present below the code with the solution:
Option Explicit
' Fonte: Saber Excel
'
' http://www.microsoftexcel.com.br/index.php/excel-dicas-microsoft-excel-vba/185-excel-vba-userforms-e-outros/1225-excel-planilha-vba-userform-sem-cabecalho.html
'======================================================================================================================================
' Retira o cabeçalho do Formulário completamente
'======================================================================================================================================
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Const SWP_FRAMECHANGED = &H20
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
Private Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long, lpRect As RECT) _
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 SetWindowPos Lib "user32" _
(ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) _
As Long
Sub RETIRAR_CABECALHO_SABEREXCEL(stCaption As String, sbxVisible As Boolean)
Dim vrWin As RECT
Dim style As Long
Dim lHwnd As Long
lHwnd = FindWindowA(vbNullString, stCaption)
GetWindowRect lHwnd, vrWin
style = GetWindowLong(lHwnd, GWL_STYLE)
If sbxVisible Then
SetWindowLong lHwnd, GWL_STYLE, style Or WS_CAPTION
Else
SetWindowLong lHwnd, GWL_STYLE, style And Not WS_CAPTION
End If
SetWindowPos lHwnd, 0, vrWin.Left, vrWin.Top, vrWin.Right - vrWin.Left, _
vrWin.Bottom - vrWin.Top, SWP_FRAMECHANGED
End Sub
Private Sub UserForm_Initialize()
RETIRAR_CABECALHO_SABEREXCEL Me.Caption, False
End Sub
Private Sub ButtonSair_Click()
Unload Me
End Sub
As the form is without the title bar, it was necessary to put a button to "exit" the form.
You can also close it with Alt+F4.
Okay, I will remove my vote to close and delete the comments. Do the same, ok?
– Luiz Vieira