Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to use application.onkey to assign the same key to one
macro in workbookA and another Macro in workbookB? And have that same shortcut key do nothing in WorkbookC? All three workbooks are open at the same time so I want the appropriate macro to run in the active workbook. I tried a few ways making the application.onkey statement conditional on the activeworkbook, but when the key was assigned, that was that. TIA, Andy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use one macro assigned to the key combination.
have it check which workbook is active and take the appropriate action. the alternative is to use the window activate event to reassign the onkey. -- Regards, Tom Ogilvy "Andy" wrote: Is there a way to use application.onkey to assign the same key to one macro in workbookA and another Macro in workbookB? And have that same shortcut key do nothing in WorkbookC? All three workbooks are open at the same time so I want the appropriate macro to run in the active workbook. I tried a few ways making the application.onkey statement conditional on the activeworkbook, but when the key was assigned, that was that. TIA, Andy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use one macro assigned to the key combination.
have it check which workbook is active and take the appropriate action. I should have been able to figure this out for myself! I'm sure I can get this to work if I only have one workbook where I want the key combination to work and don't want it to work anywhere else. This is the situation I'm dealing with now, so this will solve my problem. Not sure if I can make it work if I want the same key combo to work in two workbooks and do different things in each, with each workbook having no idea if a conflicting workbook is open, or what the name of that workbook is. Each would have a workbook_open macro to assign the key and whichever one opened last would override the other. The alternative is to use the window activate event to reassign the onkey. I fooled with this a little, but I couldn't make it unassign when I moved to another window. In most windows I want the key to be inert, and I never know what other windows will be open. I'll fool with these options and post back with better questions. Thanks, Andy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.onKey non-functioning | Excel Programming | |||
Application.OnKey | Excel Programming | |||
Application.OnKey problem | Excel Programming | |||
application.onkey doesn't work | Excel Programming | |||
Application.OnKey problem | Excel Programming |