Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2012, 01:30 AM
tinfanide tinfanide is offline Excel VBA: Key Bindings? Windows 7 64bit Excel VBA: Key Bindings? Office 2010 32bit
Expert
Excel VBA: Key Bindings?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Excel VBA: Key Bindings?


I want to add a key binding with Excel VBA. I've searched the Internet for this and only Word VBA key binding was found. The way we do in Word cannot be done in Excel:

Code:
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKey0), _          KeyCategory:=wdKeyCategoryCommand, _          Command:="TestKeybinding"
How are the codes in Excel then?
Thanks in advance.
Reply With Quote
  #2  
Old 10-15-2012, 04:25 AM
tinfanide tinfanide is offline Excel VBA: Key Bindings? Windows 7 64bit Excel VBA: Key Bindings? Office 2010 32bit
Expert
Excel VBA: Key Bindings?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

I've found some hints on the Internet, yet it doesn't work at all in my case:

http://vbadud.blogspot.hk/2007/06/assigning-shortcut-keys-excel-macros.html

Code:
Sub a()
Application.OnKey "^t", "b"
End Sub

Sub b()
MsgBox "b..."
End Sub
Reply With Quote
  #3  
Old 10-15-2012, 05:07 AM
tinfanide tinfanide is offline Excel VBA: Key Bindings? Windows 7 64bit Excel VBA: Key Bindings? Office 2010 32bit
Expert
Excel VBA: Key Bindings?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Quote:
Originally Posted by tinfanide View Post
I've found some hints on the Internet, yet it doesn't work at all in my case:

http://vbadud.blogspot.hk/2007/06/assigning-shortcut-keys-excel-macros.html

Code:
Sub a()
Application.OnKey "^t", "b"
End Sub

Sub b()
MsgBox "b..."
End Sub

Book1.xlsm
I have just tested the codes.
It works with Procedure a() but not Procedure c().
Just can't figure out why.
Please tell me if ya know why. Thanks.
Reply With Quote
Reply

Tags
key bindings, vba excel



Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel VBA: Key Bindings? Excel 2011 can't open old Excel 98 or Excel X files FLJohnson Excel 8 05-09-2012 11:26 PM
Excel 2007 custom ribbon not showing in Excel 2010 Paulzak Excel 2 02-17-2012 06:35 PM
Excel VBA: Key Bindings? saving data in excel 2010 from excel 2003 johnkcalg Excel 1 02-06-2012 07:33 PM
Excel VBA: Key Bindings? VBA code from Excel 2007 in Excel 2010 csam63 Excel Programming 1 10-07-2011 10:46 AM
Excel VBA: Key Bindings? Opening multiple Excel files within the same Excel window. lost9471 Excel 2 05-01-2010 01:57 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft