Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2023, 11:46 PM
elaineAda elaineAda is offline How to remove the 'cancel' function when user clicks the 'X' button? Windows XP How to remove the 'cancel' function when user clicks the 'X' button? Office 2010
Novice
How to remove the 'cancel' function when user clicks the 'X' button?
 
Join Date: Mar 2019
Posts: 25
elaineAda is on a distinguished road
Default How to remove the 'cancel' function when user clicks the 'X' button?

Is there a way to remove the Cancel button when the user clicks the "X" button in the upper-right corner of the Word window




I wrote the following but it didnt seem to work

Code:
Private Sub Document_BeforeClose(Cancel As Boolean)
    If ActiveDocument.Saved = False Then
        Select Case MsgBox("Do you want to save changes to this document?", vbYesNo + vbExclamation + vbDefaultButton1, "Microsoft Word")
            Case vbYes
                ActiveDocument.Save
            Case vbNo
                'Do nothing
        End Select
    End If
End Sub



Pl assist. Thanks.
Reply With Quote
  #2  
Old 02-17-2023, 03:36 AM
gmayor's Avatar
gmayor gmayor is offline How to remove the 'cancel' function when user clicks the 'X' button? Windows 10 How to remove the 'cancel' function when user clicks the 'X' button? Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

This shouldn't be necessary as Word should prompt regardless if the document is unsaved.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 02-19-2023, 06:53 PM
elaineAda elaineAda is offline How to remove the 'cancel' function when user clicks the 'X' button? Windows XP How to remove the 'cancel' function when user clicks the 'X' button? Office 2010
Novice
How to remove the 'cancel' function when user clicks the 'X' button?
 
Join Date: Mar 2019
Posts: 25
elaineAda is on a distinguished road
Default

Hi Gmayor

I want to disable the save prompt and customize it to only a (save and quit) and a (don't save and quit) prompt. Is there anyway it can be customize? Thanks.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove the 'cancel' function when user clicks the 'X' button? How to cancel the function of auto indentation? Msxfc Word 3 02-26-2022 07:24 AM
Outlook local fodlers: function and how to remove village Outlook 0 04-14-2019 01:02 AM
How to remove the 'cancel' function when user clicks the 'X' button? Remove Empty Line while using If MergeField Function stevenel Mail Merge 19 07-13-2018 06:48 AM
How to remove the 'cancel' function when user clicks the 'X' button? Restrict Editing function disable insert textbox function IanM_01 Word 5 11-21-2015 02:29 AM
How to remove the 'cancel' function when user clicks the 'X' button? #REF! Error in calling VBA function disappears when function is copied lcaretto Excel Programming 2 05-26-2014 07:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft