New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

How do I close application.onkey procedure

Macros, VBA, Excel Automation, etc.

How do I close application.onkey procedure

Postby jetjockey » Sun Jan 15, 2012 7:36 am

Hi,

As I am changing the functionality of the Function keys to accommodate my workbook, I will need to have a procedure to close. Can anyone help me with this one.

Here is the code to open

Code: Select all
Private Sub Workbook_Open()
        Application.OnKey "{F1}", "Showtold"
        Application.OnKey "{F2}", "Showcharts"
        Application.OnKey "{F3}", "Showarea"
        Application.OnKey "^{F4}", "print"
End Sub


module code

Code: Select all
Sub showtold()
   Sheets("told").Select
End Sub


Thank you for your help
  • 0

jetjockey
Rookie
 
Posts: 12
Joined: Jan 14, 2012
Location: Trenton On
Reputation: 0

Re: How do I close application.onkey procedure

Postby TMShucks » Tue Jan 17, 2012 2:55 am

http://msdn.microsoft.com/en-us/library/aa195807(v=office.11).aspx

Code: Select all
This example assigns "InsertProc" to the key sequence CTRL+PLUS SIGN and assigns "SpecialPrintProc" to the key sequence SHIFT+CTRL+RIGHT ARROW.

Application.OnKey "^{+}", "InsertProc"
Application.OnKey "+^{RIGHT}", "SpecialPrintProc"
      
This example returns SHIFT+CTRL+RIGHT ARROW to its normal meaning.

Application.OnKey "+^{RIGHT}"
      
This example disables the SHIFT+CTRL+RIGHT ARROW key sequence.

Application.OnKey "+^{RIGHT}", ""
      



Regards, TMS
  • 0

TMShucks
Rookie
 
Posts: 4
Joined: Jan 17, 2012
Reputation: 0


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 237 guests