Hi
I Need Help Vba Code Disable Key F12
Hi
I Need Help Vba Code Disable Key F12
try
application.onkey {F12}, ""
note thi only works within excel
i write code
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
application.onkey {F12}, ""
End Sub
but do not work
please help me
Last edited by etheer; 09-23-2014 at 05:06 AM.
Why would you disable F12 ?
Hi, there is a small mistake in westconn1's advice. There should be: "{F12}" (in quotation marks).
Anyway, it's not strange, that it doesn't work, etheer, because what you say is that, between user's save acceptation and save operation the user cannot use "F12" button (which is such a short time, that user won't even notice). I suppose you meant to block F12 button for the whole time, when this workbook remains opened. You should then insert this code in procedure Workbook_Activate. But beware, because it would also affect on other opened workbooks, so you should also add:
Private Sub Workbook_Deactivate()
Application.OnKey "{F12}"
End Sub
Hope it helped.
Thank you Szaraq