Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) 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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Const GWL_STYLE As Long = (-16) Private Const WS_CAPTION As Long = &HC00000 Private Sub UserForm_Initialize() Dim hwnd Dim rng As Range If Val(Application.Version) < 9 Then hwnd = FindWindow("ThunderXFrame", Me.Caption) Else hwnd = FindWindow("ThunderDFrame", Me.Caption) End If SetWindowLong hwnd, GWL_STYLE, iStyle DrawMenuBar hwnd End Sub |