Cancel Button on Msgbox / Inputbox

RoyinUK2000

Board Regular
Joined
Mar 26, 2002
Messages
79
Is there a way to stop the cancel button showing on Msg and Input boxes.

Thx
Roy
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Roy

Try
MsgBox "Hello", vbOKOnly

You will find out all the info you need and more by reading the help in Excel on the MsgBox Function.
 
Upvote 0
Will try that for my Msg boxes but does it work the same for inputboxes??????
Not sure that it does....do you know how to do this on an inputbox

Roy
 
Upvote 0
Hi Roy

While you cannot omit tye Cancel Button from an InputBox a (default) InputBox will return empty text ("") when the Cancel Button is clicked, so you could just use:

Code:
Dim strReply As String

ShowIt:
strReply = InputBox("Type any Text", "PREVENT CANCEL")
If strReply = "" Then GoTo ShowIt

MsgBox strReply

This will prevent the Cancel button from working.
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,179
Members
448,871
Latest member
hengshankouniuniu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top