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
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