Excel VBA - remove/hide or change the color of title bar of a UserForm
Автор: Ah Sing Excel TV
Загружено: 2022-11-04
Просмотров: 8875
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
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: