Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave's procedure doesn't discern the difference between pressing
Enter with an empty string and pressing the Cancel button. Instead, try the following procedure. Dim myStr As String Dim myDefault As String myDefault = "hi There!" myStr = InputBox(Prompt:="enter something or I'll use the default", _ Default:=myDefault) If StrPtr(myStr) = 0 Then MsgBox "You pressed cancel" Else MsgBox myStr End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Dave Peterson" wrote in message ... I don't think you can change the way the inputbox works. One option is to design your own form and do exactly what you want. Debra Dalgleish has some get started instructions for userforms at: http://contextures.com/xlUserForm01.html Or maybe you could just tell them what you'll use instead: Option Explicit Sub testme02() Dim myStr As String Dim myDefault As String myDefault = "hi There!" myStr = InputBox(Prompt:="enter something or I'll use the default", _ Default:=myDefault) If myStr = "" Then myStr = myDefault End If MsgBox myStr End Sub Paula wrote: I am using an input box and have it set up so that it can't be left empty, but I can't get rid of the cancel button (even though it doesn't do anything). I know it can be done, but it's escaping me at the moment...any assistance would be appreciated. -- Thanks - Paula -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MACRO: Selecting "Cancel" from a drop down to copy and paste entirerow to another sheet | Excel Discussion (Misc queries) | |||
MACRO: Selecting "Cancel" from a drop down to copy and paste entirerow to another sheet | Excel Worksheet Functions | |||
cancel the "Getting Started" Dialogue Box when I open XL/Word | Setting up and Configuration of Excel | |||
how to stop program with loop by click "Cancel" button | Excel Programming | |||
Close workbook with "Cancel=TRUE" in the BeforeClose()" | Excel Programming |