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
Смотрите видео Excel VBA - remove/hide or change the color of title bar of a UserForm онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Ah Sing Excel TV 04 Ноябрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 6,965 раз и оно понравилось 83 людям.