Microsoft Office Tutorials and References
In Depth Information
REMOVE THE CAPTION BAR FROM A USER FORM
End If
If wHandle = 0 Then Exit Sub
frm = GetWindowLong(wHandle, GWL_STYLE)
frm = frm Or &HC00000
SetWindowLong wHandle, -16, frmstyle
DrawMenuBar wHandle
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
‘Code to drag the form
If wHandle = 0 Then Exit Sub
If Button = 1 Then
ReleaseCapture
SendMessage wHandle, &HA1, 2, 0
End If
End Sub
In a regular module, use this line of code to launch the form:
Sub ShowForm()
UserForm1.Show
End Sub
When you run the macro, you have a user form that must be dismissed using
the button on the form instead of using the red X close button (Figure 143).
Figure 143. You can create a user form that
doesn’t have a red X close but on.
Summary: You can prevent the red X close button from appearing in a user
form.
Source: www.mrexcel.com/forum/showthread.php?t=45533
 
Search JabSto ::




Custom Search