Notifications
Clear all

Ocultar barra do userform

3 Posts
3 Usuários
0 Reactions
1,027 Visualizações
(@araujors)
Posts: 79
Estimable Member
Topic starter
 

Pessoal blz, como eu faço para ocultar a barra do userform, conforme imagem abaixo.

 
Postado : 03/04/2013 8:28 pm
(@alminen)
Posts: 77
Trusted Member
 

Olá!
Veja se a solução a seguir te atende:

No código do seu Userform, coloque:

Option Explicit 
 
Private Sub UserForm_Initialize() 
     
    Call RemoveCaption(Me) 
     
End Sub

A seguir, crie um módulo novo e acrescente o código abaixo:

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 
 
Sub RemoveCaption(objForm As Object) 
     
    Dim lStyle          As Long 
    Dim hMenu           As Long 
    Dim mhWndForm       As Long 
     
    If Val(Application.Version) < 9 Then 
        mhWndForm = FindWindow("ThunderXFrame", objForm.Caption) 'XL97
    Else 
        mhWndForm = FindWindow("ThunderDFrame", objForm.Caption) 'XL2000+
    End If 
    lStyle = GetWindowLong(mhWndForm, -16) 
    lStyle = lStyle And Not &HC00000 
    SetWindowLong mhWndForm, -16, lStyle 
    DrawMenuBar mhWndForm 
     
End Sub 
 
Sub ShowForm() 
     
    UserForm1.Show False 
     
End Sub

Extraído do VBAExpress. Testei aqui e funcionou!

 
Postado : 03/04/2013 9:04 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Se pretender fazer outras personalizações, de uma olhada no link abaixo :

Personalizando o Formulário 1ª, 2ª, 3ª e 4ª partes
http://www.tomasvasquez.com.br/forum/vi ... V1m46zEeE4

Inserir Menu em um Form
http://www.tomasvasquez.com.br/forum/vi ... V1m2qzEeE4

UserForm training
http://www.tomasvasquez.com.br/forum/vi ... f=16&t=650

[]s

 
Postado : 04/04/2013 5:50 am