is it possible to create a Userform without titlebar ?
In Excel 4 this was possible. Now with VBA, Excel 97 SR2 as well ?
Thanks and best regards
Andreas
Sent via Deja.com http://www.deja.com/
Before you buy.
> is it possible to create a Userform without titlebar ?
Of course it is possiple <g>; userforms are windows like all the rest.
Just use the TitleBar property of your userform as in the example below:
HTH
Stratos
---------------------------------
Option Explicit
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 TitleBarState As String
Public Property Get hWnd() As Long
hWnd = FindWindow _
( _
lpClassName:=IIf(Val(Application.Version) > 8, _
"ThunderDFrame", _
"ThunderXFrame"), _
lpWindowName:=Me.Caption _
)
End Property
Public Property Let TitleBar(bShow As Boolean)
Dim Userform_Style As Long
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Userform_Style = GetWindowLong _
( _
hWnd:=Me.hWnd, _
nIndex:=GWL_STYLE _
)
If bShow = True Then
Userform_Style = Userform_Style Or WS_CAPTION
Else
Userform_Style = Userform_Style And Not WS_CAPTION
End If
Call SetWindowLong _
( _
hWnd:=Me.hWnd, _
nIndex:=GWL_STYLE, _
dwNewLong:=Userform_Style _
)
Call DrawMenuBar(hWnd:=Me.hWnd)
If bShow = True Then TitleBarState = "On" Else TitleBarState = "Off"
End Property
Public Property Get TitleBar() As Boolean
If TitleBarState = "Off" Then TitleBar = False Else TitleBar = True
End Property
Private Sub CommandButton1_Click()
Me.TitleBar = Not Me.TitleBar
Me.Label1.Caption = Me.TitleBar
End Sub
----------------------------------------------------
thank you very much for your help, Iam a little bit astonished, such a
lot of code for such a little thing, was easier in Excel 4
Best regards