it's a bit more complicated then you may have assumed
as it cannot be done without some API functions.
Note1: you MUST have a button on the form to close it!
Note2: The Private Declare lines MUST go at the top of a userform's
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
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
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
HideCaptionBar
End Sub
keepITcool
< email : keepitcool chello nl (with @ and .) >
< homepage:
http://members.chello.nl/keepitcool >