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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,932
Messages
6,122,323
Members
449,077
Latest member
jmsotelo

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