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 ?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,558
Latest member
aivin

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
Back
Top