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
Template for free download 👉 / 690513322405880
File password 👉 AhSingMenu
Excel & VBA discussion public group 👉 / 486402069483674
Welcome to join and feel free to raise/ask questions (if any) or share Excel tricks 🤗
#excel #vba
Watch video Excel VBA - remove/hide or change the color of title bar of a UserForm online without registration, duration hours minute second in high quality. This video was added by user Ah Sing Excel TV 04 November 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 6,965 once and liked it 83 people.