X button on userforms

  • Thread starter Thread starter OJ
  • Start date Start date
O

OJ

Hi Greg, look up QueryClose in VBA Help but this will disable the
X.....

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Cancel = True
End Sub

Hth,
OJ
 
Careful, this will stop you ever closing the form. You need to allow some
function to close it, such as a code triggered close,

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode <> vbFormCode Then
Cancel = True
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
aaah, but you also said ... but this will disable the X....., and so it
will, and every other close option as well <ebg>

Bob
 
Bob Phillips said:
Careful, this will stop you ever closing the form. You need to allow some
function to close it, such as a code triggered close,

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode <> vbFormCode Then
Cancel = True
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)

Well I found this more than usefull

Thanks :)

N10
 
Hi All
This appears so simple but...... how do you turn off the Excel cell cursor
or at the very least hide it?
 
If you protect the worksheet, you can tell excel not to allow the users to
select any cell:

Option Explicit
Sub testme()

Dim wks As Worksheet
Set wks = Worksheets("sheet1")

With wks
.EnableSelection = xlNoSelection
.Protect Password:="hi"
End With

End Sub
 
Back
Top