PC Review


Reply
Thread Tools Rate Thread

Disable the redX in a form

 
 
Ewing25
Guest
Posts: n/a
 
      9th Jul 2008
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
 
Reply With Quote
 
 
 
 
Coder1215
Guest
Posts: n/a
 
      9th Jul 2008
On Jul 9, 7:16*pm, Ewing25 <Ewin...@discussions.microsoft.com> 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
 
Reply With Quote
 
PCLIVE
Guest
Posts: n/a
 
      9th Jul 2008
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" <(E-Mail Removed)> wrote in message
news:03A25B60-0F74-4E58-A472-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Ewing25
Guest
Posts: n/a
 
      9th Jul 2008
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 <Ewin...@discussions.microsoft.com> 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
>

 
Reply With Quote
 
Ewing25
Guest
Posts: n/a
 
      9th Jul 2008
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" <(E-Mail Removed)> wrote in message
> news:03A25B60-0F74-4E58-A472-(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
Gary Brown
Guest
Posts: n/a
 
      9th Jul 2008
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

 
Reply With Quote
 
Ewing25
Guest
Posts: n/a
 
      9th Jul 2008
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

 
Reply With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      9th Jul 2008
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

 
Reply With Quote
 
Harald Staff
Guest
Posts: n/a
 
      10th Jul 2008
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" <James_Thomlinson@owfg-Re-Move-This-.com> wrote in message
news:47B9EFD7-0F15-4B1B-A584-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
receiving redx =?Utf-8?B?R2VvcmdlIEEuIFlvcmtz?= Microsoft Dot NET 1 27th Jan 2007 10:18 PM
ComptMgmt Remote Admin RedX help help help =?Utf-8?B?Q2hyaXMgQXR3ZWxs?= Windows XP Accessibility 1 26th Apr 2005 06:16 PM
ComptMgmt Remote Admin REDX Help Help Help =?Utf-8?B?Q2hyaXMgQXR3ZWxs?= Microsoft Windows 2000 Enable 0 26th Apr 2005 04:08 PM
can't see pictures have redx in window =?Utf-8?B?c2F3cmlnaHQyNw==?= Windows XP Networking 0 25th Mar 2004 02:21 AM
Small eye-whitebox-redX Sandie Windows XP New Users 3 18th Sep 2003 10:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:12 PM.