when save or not save is aborted (cancel) the preset defaults are deactivated

LFKim2018

Active Member
Joined
Mar 24, 2018
Messages
267
In the workbook open sub - functions keys, formula bar & right click are all deactivated, and in the sub below it activates them back before closing..it is good if save or not save is selected because the workbook will be closed. BUT if not and CANCEL is pressed, all those presets are gone. Do I need to place the deactivation codes in the Private Sub Worksheet_SelectionChange(ByVal Target As Range) or under other sub (to re-deactivate the presets)?

many thanks

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnKey "{F1}"
Application.OnKey "{F3}"
Application.OnKey "{F4}"
Application.OnKey "{F5}"
Application.OnKey "{F6}"
Application.OnKey "{F7}"
Application.OnKey "{F8}"
Application.OnKey "{F10}"
Application.OnKey "{F11}"
Application.DisplayFormulaBar = True
Application.CommandBars("ply").Enabled = True
End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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