Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-23-2024, 05:49 AM
Bill Martz Bill Martz is offline Assigned shortcut works in open workbook but also opens closed workbook Windows 7 64bit Assigned shortcut works in open workbook but also opens closed workbook Office 2013
Novice
Assigned shortcut works in open workbook but also opens closed workbook
 
Join Date: Apr 2015
Posts: 9
Bill Martz is on a distinguished road
Default Assigned shortcut works in open workbook but also opens closed workbook

During 2024, I assigned a shortcut to a macro in a workbook for tracking finances. At the end of each year, I make a copy of the workbook and convert it to work for the upcoming year. I have prepared a copy of the 2024 workbook and converted it for 2025. I find now that when I use the shortcut in the 2024 workbook, it opens the 2025 workbook, even though it is closed. I don't want to change the shortcut for every workbook I create. Is there a way to have the shortcut work for only the open workbook?
Reply With Quote
  #2  
Old 12-23-2024, 08:24 AM
Logit Logit is offline Assigned shortcut works in open workbook but also opens closed workbook Windows 10 Assigned shortcut works in open workbook but also opens closed workbook Office 2007
Expert
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

#1 Sounds like your shortcut references the 2024 workbook and not the 2025 ?

#2 If both workbooks are in the same folder, try moving one to a different folder ?
Reply With Quote
  #3  
Old 12-23-2024, 09:09 AM
Bill Martz Bill Martz is offline Assigned shortcut works in open workbook but also opens closed workbook Windows 7 64bit Assigned shortcut works in open workbook but also opens closed workbook Office 2013
Novice
Assigned shortcut works in open workbook but also opens closed workbook
 
Join Date: Apr 2015
Posts: 9
Bill Martz is on a distinguished road
Default

Moved Financial Report 2025 to a different folder and then tried to run macro with shortcut in Financial Report 2024 and this popped up:







So I moved it back to the original folder.


The shortcut was assigned to the 2024 workbook macro UpdateAccountActualTable some months ago. A week ago it was assigned to the 2025 workbook macro. When I press the shortcut key combination Alt+Ctrl+d while working in the 2024 workbook, the 2025 workbook opens and tried to run the macro, which produces a message box saying it can't be run until 2025, and then the macro runs in the 2024 workbook.


I was running the macro by clicking on a text box button that had the macro assigned to it. I wanted to make life easier, so I assigned the shortcut to the macro. It appears that shortcuts don't just apply to the workbook you are working in, but to all workbooks, open or closed, in which the shortcut is assigned to a macro.
Reply With Quote
  #4  
Old 12-23-2024, 09:15 AM
Bill Martz Bill Martz is offline Assigned shortcut works in open workbook but also opens closed workbook Windows 7 64bit Assigned shortcut works in open workbook but also opens closed workbook Office 2013
Novice
Assigned shortcut works in open workbook but also opens closed workbook
 
Join Date: Apr 2015
Posts: 9
Bill Martz is on a distinguished road
Default

What popped up was a dialog box saying the 2025 file couldn't be found. My screenshot didn't get posted.
Reply With Quote
  #5  
Old 12-23-2024, 09:58 AM
Bill Martz Bill Martz is offline Assigned shortcut works in open workbook but also opens closed workbook Windows 7 64bit Assigned shortcut works in open workbook but also opens closed workbook Office 2013
Novice
Assigned shortcut works in open workbook but also opens closed workbook
 
Join Date: Apr 2015
Posts: 9
Bill Martz is on a distinguished road
Default

I have realized I didn't assign the shortcut using the Macro dialog. I put it in a Workbook_Open macro using OnKey. Even after commenting that out, and trying to remove any shortcut assigned by using Macro/Options, the macro still runs.
Reply With Quote
  #6  
Old 12-23-2024, 10:45 AM
Bill Martz Bill Martz is offline Assigned shortcut works in open workbook but also opens closed workbook Windows 7 64bit Assigned shortcut works in open workbook but also opens closed workbook Office 2013
Novice
Assigned shortcut works in open workbook but also opens closed workbook
 
Join Date: Apr 2015
Posts: 9
Bill Martz is on a distinguished road
Default

Since the macro only works during the year the workbook applies to, I decided to disable the shortcut in the 2025 workbook until 2025. It seems to be a weakness that a shortcut doesn't only work in the open workbook.
Reply With Quote
  #7  
Old 12-23-2024, 02:18 PM
Bill Martz Bill Martz is offline Assigned shortcut works in open workbook but also opens closed workbook Windows 7 64bit Assigned shortcut works in open workbook but also opens closed workbook Office 2013
Novice
Assigned shortcut works in open workbook but also opens closed workbook
 
Join Date: Apr 2015
Posts: 9
Bill Martz is on a distinguished road
Default

When I tried to disable the shortcut, it did not work until I restarted my computer. I suspect that if I had closed all workbooks and reopened the 2024 workbook, I would have found the shortcut disabled in the 2025 workbook. Restart not needed. Just a guess right now. Not going to bother testing it.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook opens on one PC but not another PencilPoint Excel 6 12-21-2023 12:38 AM
Hyperlink function only fully works when referring workbook is open batchmaster Excel 1 01-26-2018 12:27 PM
Macro for automatically refreshing Data connection on Closed excel workbook. ramzan11b Excel 1 11-24-2017 08:55 AM
Assigned shortcut works in open workbook but also opens closed workbook need vba code export data to closed workbook sheets manilara Excel Programming 1 02-12-2016 08:20 PM
Assigned shortcut works in open workbook but also opens closed workbook Run Code when Workbook opens gbaker Excel Programming 2 07-10-2012 10:41 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:09 PM.


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