Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle cancel when using the inputbox method
How can I handle the return from a CANCEL button that is clicked on when the
inputbox method is present. As far as I can tell there is nothing available to test on. The Inputbox Function is not an option. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle cancel when using the inputbox method
Is this what you want?
Dim rslt As Variant rslt = Application.InputBox("Enter Stuff") If rslt = False Then MsgBox "Cancelled" Else MsgBox rslt End If Hope this helps Rowan Lawood wrote: How can I handle the return from a CANCEL button that is clicked on when the inputbox method is present. As far as I can tell there is nothing available to test on. The Inputbox Function is not an option. Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle cancel when using the inputbox method
Try this:
Sub test() Dim strTemp As String strTemp = InputBox("testing the Cancel button") If StrPtr(strTemp) = 0 Then MsgBox "Cancel was pressed" Else MsgBox "OK was pressed" End If End Sub RBS "Lawood" wrote in message ... How can I handle the return from a CANCEL button that is clicked on when the inputbox method is present. As far as I can tell there is nothing available to test on. The Inputbox Function is not an option. Thanks in advance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle cancel when using the inputbox method
If you enter a zero and do OK it will be a Cancel.
I think using StrPtr is the only way. RBS "Rowan Drummond" wrote in message ... Is this what you want? Dim rslt As Variant rslt = Application.InputBox("Enter Stuff") If rslt = False Then MsgBox "Cancelled" Else MsgBox rslt End If Hope this helps Rowan Lawood wrote: How can I handle the return from a CANCEL button that is clicked on when the inputbox method is present. As far as I can tell there is nothing available to test on. The Inputbox Function is not an option. Thanks in advance. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle cancel when using the inputbox method
I have just been reading up on StrPtr following your post - it's a new
one for me. Thanks. Regards Rowan RB Smissaert wrote: If you enter a zero and do OK it will be a Cancel. I think using StrPtr is the only way. RBS "Rowan Drummond" wrote in message ... Is this what you want? Dim rslt As Variant rslt = Application.InputBox("Enter Stuff") If rslt = False Then MsgBox "Cancelled" Else MsgBox rslt End If Hope this helps Rowan Lawood wrote: How can I handle the return from a CANCEL button that is clicked on when the inputbox method is present. As far as I can tell there is nothing available to test on. The Inputbox Function is not an option. Thanks in advance. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle cancel when using the inputbox method
Hello Lawood, Just for reference, the InputBox method returns a boolean False when Cancel is pressed and the InputBox function returns an empty string. Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=493240 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to handle cancel when using the inputbox method
That did the trick. Thanks to everyone for their help.
"Lawood" wrote: How can I handle the return from a CANCEL button that is clicked on when the inputbox method is present. As far as I can tell there is nothing available to test on. The Inputbox Function is not an option. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Detecting Cancel in an InputBox Method | Excel Discussion (Misc queries) | |||
Cancel button in Inputbox method | Excel Programming | |||
Inputbox method using type:=8 - How to Cancel? | Excel Programming | |||
Inputbox method using type:=8 - How to Cancel? | Excel Programming | |||
Inputbox method using type:=8 - How to Cancel? | Excel Programming |