User Form Title Bar

C

Celtic_Avenger

Hi Peeps.....Hope someone can help.


Is there a simple way to remove the titlebar on a userform.

The reason I need this is because I am using a simple buttonles
userform to display a warning if certain cells are selected. Thi
userform then disappears after a time delay.

I dont want the user to be able to click the X button on the userfor
titlebar.

Hope someone can help.


Thanks in advance.


Celtic_Avenger
:confused: :confused: :confused: :confused: :confused
 
M

Michel Pierron

Hi Celtic_Avenger,
In the UserForm module:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) 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 Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hWnd, -16, &H84080080
DrawMenuBar hWnd
End Sub

MP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top