Success! Got the code to work thanks, M
gary
"MDubbelboer" wrote:
Hammer1947 Wrote:
Thanks Leith,
I don't want to have to Alt F8 to display the form. The form needs to
be
loaded and visible at all times while the excel program is running. The
only
thing I was concerned about was the close "X". If I accidentally click
the
close "X" the form goes away and I can't get it back. Ideally would be
to get
rid of the "X" button since I never want to close it during the running
of
the program. This form has buttons on it that are always used during
the
program.
gary
from: http://www.contextures.com/xlUserForm01.html
To prevent users from closing the form by clicking the X button:
1. Right-click on an empty part of the UserForm
2. Choose View | Code
3. Scroll to the bottom of the existing code, and enter the
following code:
Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the button!"
End If
End Sub
4. On the Menu bar, choose View | Object, to return to the
UserForm.
--
MDubbelboer
------------------------------------------------------------------------
MDubbelboer's Profile: http://www.excelforum.com/member.php...o&userid=36330
View this thread: http://www.excelforum.com/showthread...hreadid=562333