Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default input box - I don't need the "cancel" button

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default input box - I don't need the "cancel" button

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default input box - I don't need the "cancel" button


Hi Paula,

The best thing to do is follows Dave's advice, since Excel doesn't
provide any direct means of removing the Cancel button thorugh the
InputBox properties. It can be done using API calls, but the complexity
far outweighs the ease and versatility you can get by creating a
UserForm. However if you are really interested in the API method, let
me know.

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=482077

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default input box - I don't need the "cancel" button

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
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
MACRO: Selecting "Cancel" from a drop down to copy and paste entirerow to another sheet Nicole Hannington Excel Discussion (Misc queries) 1 July 20th 09 07:11 PM
MACRO: Selecting "Cancel" from a drop down to copy and paste entirerow to another sheet Nicole Hannington Excel Worksheet Functions 1 July 20th 09 06:51 PM
cancel the "Getting Started" Dialogue Box when I open XL/Word jazzy1 Setting up and Configuration of Excel 1 May 2nd 08 12:53 AM
how to stop program with loop by click "Cancel" button miao jie Excel Programming 2 December 16th 04 02:42 PM
Close workbook with "Cancel=TRUE" in the BeforeClose()" Wellie[_3_] Excel Programming 1 October 16th 04 09:46 PM


All times are GMT +1. The time now is 01:18 PM.

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

About Us

"It's about Microsoft Excel"