Userform as floating menu without borders

Sinbad

Board Regular
Joined
Apr 18, 2012
Messages
224
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.

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 ?
 

Some videos you may like

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Watch MrExcel Video

Forum statistics

Threads
1,122,964
Messages
5,599,069
Members
414,281
Latest member
Engjamal2021

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top