Disable or hide Cancel button on Save dialog box

S

Sandy

How do I hide or disable the cancel button on the normal "Do you want to
save the changes etc......" dialog box.
I presume code would be inserted into the "Workbook_BeforeClose(Cancel As
Boolean)" module.

TIA
Sandy
 
S

Sandy

Can't get that to work Sam - Dialog box still contains Cancel:- full code as
follows:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

ActiveWorkbook.Unprotect

Application.ScreenUpdating = False
Application.EnableEvents = False

Sheets("Current Round").Unprotect Password:=""
Sheets("Current Round Detailed").Unprotect Password:=""
Sheets("Current Round Graph").Unprotect Password:=""
Sheets("Home Graphs").Unprotect Password:=""
Sheets("Home Detailed Graphs").Unprotect Password:=""
Sheets("All Rounds").Unprotect Password:=""
Sheets("View Rounds").Unprotect Password:=""
Sheets("Search Rounds").Unprotect Password:=""
'Sheets("LogGraph3").Unprotect Password:=""

Dim wksht As Worksheet

With Application
.DisplayFormulaBar = True
.CommandBars("Worksheet Menu Bar").Enabled = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
.CommandBars("Drawing").Visible = True
End With

For Each wksht In Worksheets(Array("Current Round", "Current Round
Detailed", _
"Current Round Graph", "Home Detailed Graphs", "Home Graphs", "All
Rounds", "View Rounds", "Search Rounds"))
wksht.Activate
ActiveWindow.DisplayHeadings = True
Next

Sheets("Current Round").Visible = False
Sheets("Current Round Detailed").Visible = False
Sheets("Current Round Graph").Visible = False
Sheets("Home Graphs").Visible = False
Sheets("Home Detailed Graphs").Visible = False
Sheets("All Rounds").Visible = False
Sheets("LogGraph3").Visible = True
Sheets("View Rounds").Visible = False
Sheets("Search Rounds").Visible = False

Sheets("RecordOfRounds").Visible = xlSheetVeryHidden
Sheets("RecordOfRoundsDetailed").Visible = xlSheetVeryHidden
Sheets("HomeCourse").Visible = xlSheetVeryHidden
Sheets("HomeDetailed").Visible = xlSheetVeryHidden
Sheets("LogGraph1").Visible = xlSheetVeryHidden
Sheets("LogGraph2").Visible = xlSheetVeryHidden
'Sheets("LogGraph3").Visible = xlSheetVeryHidden
Sheets("LogGraph4").Visible = xlSheetVeryHidden
Sheets("LogGraph5").Visible = xlSheetVeryHidden
Sheets("LogGraph6").Visible = xlSheetVeryHidden
Sheets("LogGraph7").Visible = xlSheetVeryHidden
Sheets("SearchRoundsData").Visible = xlSheetVeryHidden
Sheets("SearchRoundsDataDetailed").Visible = xlSheetVeryHidden
Sheets("SearchDataFiltered").Visible = xlSheetVeryHidden
Sheets("SearchDataFilteredDetailed").Visible = xlSheetVeryHidden

Sheets("LogGraph3").Protect Password:=""

Application.ScreenUpdating = True
Application.EnableEvents = True

ActiveWorkbook.Protect Structure:=True, Windows:=False

Application.DisplayAlerts = False

End Sub

Sandy
 
J

Jim Thomlinson

You can not modify the dialog boxes that pop up. The only thing you could do
would be to pre-empt it showing up in the first place. Then you can display
your own form which can look however you want it to...

In the before close event check the saved property. If it is false then you
will need to handle the saving of the file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top