Ir ao conteúdo
  • Cadastre-se

Excel api vba como tirar a borda


Posts recomendados

Olá pessoal, eu estou trabalhando no desenvolvimento de alguns programas, estou usando a linguagem do VBA, porém estou querendo dar um toque mais profissional e gostaria de retirar as bordas do userform inicial, dentre todas as soluções que achei na web nenhuma funcional e parece ser algum erro de incompatibilidade de versões, talvez a  versão mais nova do VBA tenha algum método mais tranquilo de fazer, se alguém souber alguma coisa, agradeço  a ajuda.

 

as formulas que achei na internet são variações desta.

 

Private Sub UserForm_Initialize()
   Label2.Visible = False
   RETIRAR_CABECALHO_SABEREXCEL Me.Caption, False
End Sub

Public 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

Public Declare Function FindWindowA Lib "user32" _
        (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
       
Public Declare Function GetWindowRect Lib "user32" _
        (ByVal hwnd As Long, lpRect As RECT) As Long
       
Public Declare Function GetWindowLong Lib "user32" Alias _
        "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Public Declare Function SetWindowLong Lib "user32" Alias _
        "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
        ByVal dwNewLong As Long) As Long

Public 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

Sub abrir_form()
frmSaber.Show
End Sub

Link para o comentário
Compartilhar em outros sites

Crie uma conta ou entre para comentar

Você precisa ser um usuário para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar agora

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...