Is there a way to store the current Procedure on an OnKey?
Example:
If you open up workbook "A" this is the code in the ThisWorkbook Object:
As you can tell if the workbook is closed the OnKeys get reset to their default. Is there a way to store what ever was on the onkey procedure prior to assigning it a new procedure then assigning it back when the workbook is closed?
Example:
If you open up workbook "A" this is the code in the ThisWorkbook Object:
Code:
Private Sub Workbook_Open()
With Application
.DisplayAlerts = False
.OnKey "^{g}", "'" & ThisWorkbook.Name & "'!Password_Macros.Unprotect"
.OnKey "^+{t}", "'" & ThisWorkbook.Name & "'!Password_Macros.Protect"
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Application
.OnKey "^{g}"
.OnKey "^+{t}"
.DisplayAlerts = True
End With
End Sub
As you can tell if the workbook is closed the OnKeys get reset to their default. Is there a way to store what ever was on the onkey procedure prior to assigning it a new procedure then assigning it back when the workbook is closed?