Consulting

Results 1 to 6 of 6

Thread: I Need Help Vba Code Disable Key F12

  1. #1

    I Need Help Vba Code Disable Key F12

    Hi
    I Need Help Vba Code Disable Key F12

  2. #2
    try
    application.onkey {F12}, ""

    note thi only works within excel

  3. #3
    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.

  4. #4
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,644
    Why would you disable F12 ?

  5. #5
    VBAX Regular
    Joined
    Sep 2014
    Posts
    6
    Location
    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.

  6. #6
    Thank you Szaraq

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •