disable msgbox close 'X'

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,604
Office Version
  1. 365
Platform
  1. Windows
is it possible to disable or remove the msgbox 'x' close button by adapting my code below?

Code:
 Else: FinalisePrompt = MsgBox(vbCrLf & _
        "  This report has not yet been finalised and before" & vbCrLf & _
        "  continuing it must be done." & vbCrLf & vbCrLf & _
        "  Please click on the 'OK' button below" & vbCrLf & _
        "  to carry out the report finalisation. " & vbCrLf & " ", _
        Buttons:=vbYes, Title:=" STOP! - Report has not yet been finalised! ")

    If FinalisePrompt = vbOK Then
            MsgBox ("yippppee")

many thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
is it possible to disable or remove the msgbox 'x' close button by adapting my code below?

Code:
 Else: FinalisePrompt = MsgBox(vbCrLf & _
        "  This report has not yet been finalised and before" & vbCrLf & _
        "  continuing it must be done." & vbCrLf & vbCrLf & _
        "  Please click on the 'OK' button below" & vbCrLf & _
        "  to carry out the report finalisation. " & vbCrLf & " ", _
        Buttons:=[COLOR=red]vbYes[/COLOR], Title:=" STOP! - Report has not yet been finalised! ")
 
    If FinalisePrompt = vbOK Then
            MsgBox ("yippppee")

many thanks


The Buttons arg should be vbYesNo. This will disable the 'x'
 
Upvote 0
but by changing the Button arg to vbYesNo this then populates the msgbox with a yes/no button.
The only button I want is an OK with the X (close) disabled, ie forcing the user to click on the OK button

thanks
 
Upvote 0
Okay, I re-read your code a bit, but am confused. If there is only one option to dismiss the msgbox, what is the point of an IF test?
 
Upvote 0
Ok, so i think only way around this is to create a userform to act like the msg box and use
Code:
Private Sub UserForm_QueryClose(Cancel As Integer, _
  CloseMode As Integer)
  If CloseMode = vbFormControlMenu Then
    Cancel = True
    MsgBox "Please use the button!"
  End If
End Sub
to disable the X close function

thanks anyway guys
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,704
Members
452,938
Latest member
babeneker

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