Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Disable the redX in a form

Okay so i have a inputbox that pops up from this code.

Dim Message2, Title2, MyValue
Message = "Please Enter Last 5 Digits of Your Card Number"
Title = "AMEX Number" '<--Change
MyValue = InputBox(Message, Title)

If MyValue = "" Then
Sheets("Expense Amex").Protect password:="welcome"
Exit Sub

End If


Range("Cardholder_Number").AutoFilter
Range("Cardholder_Number").AutoFilter Field:=1, Criteria1:=MyValue,
visibleDropDown:=False
Sheets("Expense Amex").Protect password:="welcome"
On Error Resume Next

What i want to do is make it so they cant press the red X in the top right
of the form. how do i do this?

Thanks,
Alex
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Disable the redX in a form

On Jul 9, 7:16*pm, Ewing25 wrote:
Okay so i have a inputbox that pops up from this code.

Dim Message2, Title2, MyValue
* * *Message = "Please Enter Last 5 Digits of Your Card Number"
* * Title = "AMEX Number" *'<--Change
* * MyValue = InputBox(Message, Title)

*If MyValue = "" Then
* *Sheets("Expense Amex").Protect password:="welcome"
* Exit Sub

*End If

* * Range("Cardholder_Number").AutoFilter
* * Range("Cardholder_Number").AutoFilter Field:=1, Criteria1:=MyValue,
visibleDropDown:=False
* * Sheets("Expense Amex").Protect password:="welcome"
On Error Resume Next

What i want to do is make it so they cant press the red X in the top right
of the form. how do i do this?

Thanks,
Alex


Hi Alex,

Try to include following code in your form:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
'message maybe
End If
End Sub

regards

Peter
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default Disable the redX in a form

Alex,

My understanding is that you cannot disable the Close X on an InputBox.
However, using code you can disable one on a userform. I believe that is
what the other reply was trying to tell you, even though you aren't
currently using a UserForm.

Using this code in your UserForm will force a user to click a command button
to close the form. If the user clicks the X, a message will appear telling
them it is disabled.

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = 0 Then
Cancel = True
MsgBox "The X is disabled, please use a button on the form.",
vbCritical
End If

End Sub



Regards,
Paul
--

"Ewing25" wrote in message
...
Okay so i have a inputbox that pops up from this code.

Dim Message2, Title2, MyValue
Message = "Please Enter Last 5 Digits of Your Card Number"
Title = "AMEX Number" '<--Change
MyValue = InputBox(Message, Title)

If MyValue = "" Then
Sheets("Expense Amex").Protect password:="welcome"
Exit Sub

End If


Range("Cardholder_Number").AutoFilter
Range("Cardholder_Number").AutoFilter Field:=1, Criteria1:=MyValue,
visibleDropDown:=False
Sheets("Expense Amex").Protect password:="welcome"
On Error Resume Next

What i want to do is make it so they cant press the red X in the top right
of the form. how do i do this?

Thanks,
Alex



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Disable the redX in a form

I added it like this and it doesnt seem to work. Any suggestions?

Dim Message2, Title2, MyValue
Dim Cancel As Integer
Dim CloseMode As Integer
If CloseMode = vbFormControlMenu Then
Cancel = True



Message = "Please Enter Last 5 Digits of Your Card Number"
Title = "AMEX Number" '<--Change
MyValue = InputBox(Message, Title)

If MyValue = "" Then
Sheets("Expense Amex").Protect password:="welcome"
Exit Sub

End If
End If

"Coder1215" wrote:

On Jul 9, 7:16 pm, Ewing25 wrote:
Okay so i have a inputbox that pops up from this code.

Dim Message2, Title2, MyValue
Message = "Please Enter Last 5 Digits of Your Card Number"
Title = "AMEX Number" '<--Change
MyValue = InputBox(Message, Title)

If MyValue = "" Then
Sheets("Expense Amex").Protect password:="welcome"
Exit Sub

End If

Range("Cardholder_Number").AutoFilter
Range("Cardholder_Number").AutoFilter Field:=1, Criteria1:=MyValue,
visibleDropDown:=False
Sheets("Expense Amex").Protect password:="welcome"
On Error Resume Next

What i want to do is make it so they cant press the red X in the top right
of the form. how do i do this?

Thanks,
Alex


Hi Alex,

Try to include following code in your form:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
'message maybe
End If
End Sub

regards

Peter

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Disable the redX in a form

So to achieve what im trying to do i have to create a userform and put the
code behind that?

"PCLIVE" wrote:

Alex,

My understanding is that you cannot disable the Close X on an InputBox.
However, using code you can disable one on a userform. I believe that is
what the other reply was trying to tell you, even though you aren't
currently using a UserForm.

Using this code in your UserForm will force a user to click a command button
to close the form. If the user clicks the X, a message will appear telling
them it is disabled.

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = 0 Then
Cancel = True
MsgBox "The X is disabled, please use a button on the form.",
vbCritical
End If

End Sub



Regards,
Paul
--

"Ewing25" wrote in message
...
Okay so i have a inputbox that pops up from this code.

Dim Message2, Title2, MyValue
Message = "Please Enter Last 5 Digits of Your Card Number"
Title = "AMEX Number" '<--Change
MyValue = InputBox(Message, Title)

If MyValue = "" Then
Sheets("Expense Amex").Protect password:="welcome"
Exit Sub

End If


Range("Cardholder_Number").AutoFilter
Range("Cardholder_Number").AutoFilter Field:=1, Criteria1:=MyValue,
visibleDropDown:=False
Sheets("Expense Amex").Protect password:="welcome"
On Error Resume Next

What i want to do is make it so they cant press the red X in the top right
of the form. how do i do this?

Thanks,
Alex






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default Disable the redX in a form

Do While MyValue = ""
MyValue = InputBox(Message, Title)
Loop

....will keep the inputbox showing until something is entered.
--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown


"Ewing25" wrote:

Okay so i have a inputbox that pops up from this code.

Dim Message2, Title2, MyValue
Message = "Please Enter Last 5 Digits of Your Card Number"
Title = "AMEX Number" '<--Change
MyValue = InputBox(Message, Title)

If MyValue = "" Then
Sheets("Expense Amex").Protect password:="welcome"
Exit Sub

End If


Range("Cardholder_Number").AutoFilter
Range("Cardholder_Number").AutoFilter Field:=1, Criteria1:=MyValue,
visibleDropDown:=False
Sheets("Expense Amex").Protect password:="welcome"
On Error Resume Next

What i want to do is make it so they cant press the red X in the top right
of the form. how do i do this?

Thanks,
Alex

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Disable the redX in a form

That works great! thanks!

"Gary Brown" wrote:

Do While MyValue = ""
MyValue = InputBox(Message, Title)
Loop

...will keep the inputbox showing until something is entered.
--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown


"Ewing25" wrote:

Okay so i have a inputbox that pops up from this code.

Dim Message2, Title2, MyValue
Message = "Please Enter Last 5 Digits of Your Card Number"
Title = "AMEX Number" '<--Change
MyValue = InputBox(Message, Title)

If MyValue = "" Then
Sheets("Expense Amex").Protect password:="welcome"
Exit Sub

End If


Range("Cardholder_Number").AutoFilter
Range("Cardholder_Number").AutoFilter Field:=1, Criteria1:=MyValue,
visibleDropDown:=False
Sheets("Expense Amex").Protect password:="welcome"
On Error Resume Next

What i want to do is make it so they cant press the red X in the top right
of the form. how do i do this?

Thanks,
Alex

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Disable the redX in a form

While I am not saying don't do what you are planning on doing, I have found
that users don't like mandatory fields that they can not get out of. IMO you
are better off to catch where they have exited the input without entering
anything and letting them know the consequences of leaving that field blank.
Then allow them to try again ro whatever is needed...
--
HTH...

Jim Thomlinson


"Ewing25" wrote:

That works great! thanks!

"Gary Brown" wrote:

Do While MyValue = ""
MyValue = InputBox(Message, Title)
Loop

...will keep the inputbox showing until something is entered.
--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown


"Ewing25" wrote:

Okay so i have a inputbox that pops up from this code.

Dim Message2, Title2, MyValue
Message = "Please Enter Last 5 Digits of Your Card Number"
Title = "AMEX Number" '<--Change
MyValue = InputBox(Message, Title)

If MyValue = "" Then
Sheets("Expense Amex").Protect password:="welcome"
Exit Sub

End If


Range("Cardholder_Number").AutoFilter
Range("Cardholder_Number").AutoFilter Field:=1, Criteria1:=MyValue,
visibleDropDown:=False
Sheets("Expense Amex").Protect password:="welcome"
On Error Resume Next

What i want to do is make it so they cant press the red X in the top right
of the form. how do i do this?

Thanks,
Alex

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default Disable the redX in a form

Very true, Jim. Users will Ctrl Alt Delete their way out of the painful
experience and refuse to touch it ever after.

Best wishes Harald

"Jim Thomlinson" wrote in message
...
While I am not saying don't do what you are planning on doing, I have
found
that users don't like mandatory fields that they can not get out of. IMO
you
are better off to catch where they have exited the input without entering
anything and letting them know the consequences of leaving that field
blank.
Then allow them to try again ro whatever is needed...
--
HTH...

Jim Thomlinson


"Ewing25" wrote:

That works great! thanks!

"Gary Brown" wrote:

Do While MyValue = ""
MyValue = InputBox(Message, Title)
Loop

...will keep the inputbox showing until something is entered.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
disable objects on form ranswrt Excel Programming 1 April 22nd 08 02:43 PM
disable saving excel form ecohen1[_5_] Excel Programming 2 December 8th 05 06:44 PM
disable form movement Liedson31 Excel Programming 2 May 9th 05 11:40 AM
I need to disable to X on a user form cwwolfdog Excel Discussion (Misc queries) 2 March 28th 05 02:33 AM
Disable Label in a Form Stuart[_21_] Excel Programming 4 March 13th 05 11:04 PM


All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"