filmov
tv
Excel VBA - remove/hide or change the color of title bar of a UserForm
![preview_player](https://i.ytimg.com/vi/9H_ZUt5PaDM/hqdefault.jpg)
Показать описание
How to remove the title bar or the menu bar of a UserForm?
How to change the colour of title bar of a UserForm without effecting the system's window?
Simple hack the customize the title bar or the menu bar of a UserForm without effecting the system.
-----------------------------------------------------------------------------------------------------------------------
Code:
Option Explicit
Option Private Module
Public Const GWL_Style = -16
Public Const WS_Caption = &HC00000
Public Declare Function FindWindowA Lib "user32" (ByVal lpclassname As String, ByVal lpwindowname As String) As Long
Public Declare Function GetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Sub RemoveTitleBar(uf As Object)
Call SetWindowLongA(FindWindowA(vbNullString, uf.Caption), GWL_Style, GetWindowLongA(FindWindowA(vbNullString, uf.Caption), GWL_Style) And Not WS_Caption)
Call DrawMenuBar(FindWindowA(vbNullString, uf.Caption))
End Sub
-----------------------------------------------------------------------------------------------------------------------
Other Functions/Properties:
1. Me.Height
2. Me.Width
File password 👉 AhSingMenu
Welcome to join and feel free to raise/ask questions (if any) or share Excel tricks 🤗
#excel #vba
How to change the colour of title bar of a UserForm without effecting the system's window?
Simple hack the customize the title bar or the menu bar of a UserForm without effecting the system.
-----------------------------------------------------------------------------------------------------------------------
Code:
Option Explicit
Option Private Module
Public Const GWL_Style = -16
Public Const WS_Caption = &HC00000
Public Declare Function FindWindowA Lib "user32" (ByVal lpclassname As String, ByVal lpwindowname As String) As Long
Public Declare Function GetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Sub RemoveTitleBar(uf As Object)
Call SetWindowLongA(FindWindowA(vbNullString, uf.Caption), GWL_Style, GetWindowLongA(FindWindowA(vbNullString, uf.Caption), GWL_Style) And Not WS_Caption)
Call DrawMenuBar(FindWindowA(vbNullString, uf.Caption))
End Sub
-----------------------------------------------------------------------------------------------------------------------
Other Functions/Properties:
1. Me.Height
2. Me.Width
File password 👉 AhSingMenu
Welcome to join and feel free to raise/ask questions (if any) or share Excel tricks 🤗
#excel #vba
Комментарии