Hi all,
I have a userform that floats as a menu, working great.... BUT...
It has a border at the bottom I would LOVE to get rid of. I have made the form as small as I can in the editor, tried various bits and pieces of code, but none of them gives me exactly what I want.
here a pic of what I have and of what I want
https://www.dropbox.com/s/w0llavg9aqkb2fv/03-05-2013 18-44-29.png?m
and the corresponding code currently in use.
Any takers ?
I have a userform that floats as a menu, working great.... BUT...
It has a border at the bottom I would LOVE to get rid of. I have made the form as small as I can in the editor, tried various bits and pieces of code, but none of them gives me exactly what I want.
here a pic of what I have and of what I want
https://www.dropbox.com/s/w0llavg9aqkb2fv/03-05-2013 18-44-29.png?m
and the corresponding code currently in use.
Code:
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 ShowWindow Lib "user32" ( _
ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Declare Function SetFocus Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Const GWL_STYLE As Long = (-16)
Private Const GWL_EXSTYLE As Long = (-20)
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_EX_DLGMODALFRAME As Long = &H1
Private Const SC_CLOSE As Long = &HF060
Private Const SW_SHOW As Long = 5
Private Sub UserForm_Initialize()
Dim iStyle As Long
Dim hWndForm As Long
hWndForm = FindWindow(vbNullString, Me.Caption) 'XL97
iStyle = GetWindowLong(hWndForm, GWL_STYLE)
iStyle = iStyle And Not WS_CAPTION
SetWindowLong hWndForm, GWL_STYLE, iStyle
iStyle = GetWindowLong(hWndForm, GWL_EXSTYLE)
iStyle = iStyle And Not WS_EX_DLGMODALFRAME
SetWindowLong hWndForm, GWL_EXSTYLE, iStyle
ShowWindow hWndForm, SW_SHOW
DrawMenuBar hWndForm
SetFocus hWndForm
End Sub
Any takers ?