![]() |
UserForm Title Bar
Hi all,
I need to hide the UserForm Title Bar, I know how to disable the Close button; but for a special project I want to display UserFormswithout any options or a title. If anyone knows a way to do this let me know; your assistance would be greatly appreciated. Yours sincerely, Brent McIntyre *** Sent via Developersdex http://www.developersdex.com *** |
UserForm Title Bar
In the userform code put this at the top of the module ......
Private Declare Function FindWindow Lib "user32" Alias _ "FindWindowA" (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hWnd As Long, _ ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" ( _ ByVal hWnd As Long) As Long In the form intialize event call the function......... Private Sub UserForm_Initialize() HideCaptionBar End Sub Add the following function which is called from the intialize event .................. Private Function HideCaptionBar() Dim lngHnd As Long Dim lngStyle As Long Dim lngH(1) As Long Const GWL_STYLE = (-16) Const WS_CAPTION = &HC00000 lngH(0) = Me.Height - Me.InsideHeight If Val(Application.Version) 8 Then lngHnd = FindWindow("ThunderDFrame", Me.Caption) Else lngHnd = FindWindow("ThunderXFrame", Me.Caption) End If lngStyle = GetWindowLong(lngHnd, GWL_STYLE) And Not WS_CAPTION SetWindowLong lngHnd, GWL_STYLE, lngStyle DrawMenuBar lngHnd lngH(1) = Me.Height - Me.InsideHeight Me.Height = Me.Height + lngH(1) - lngH(0) End Function -- Cheers Nigel "Brent McIntyre" wrote in message ... Hi all, I need to hide the UserForm Title Bar, I know how to disable the Close button; but for a special project I want to display UserFormswithout any options or a title. If anyone knows a way to do this let me know; your assistance would be greatly appreciated. Yours sincerely, Brent McIntyre *** Sent via Developersdex http://www.developersdex.com *** |
UserForm Title Bar
Nigel,
Thanks for your assistance it worked perfectly ! Yours sincerely, Brent McIntyre *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 01:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com