![]() |
Call macro from active workbook
I may have 2 or 3 workbooks open, each has a custom print macro that is
activated with Ctrl-P. However, Ctrl P does not call the macro from the active workbook. Seems like I read somewhere when there are duplicate shortcut keys, Excel calls macros from workbooks in alphabetical order. How can I force Excel to call the macro from the active workbook? Thank you. |
Call macro from active workbook
You would be better off saving the macro in PERSONAL.xls then it would be available on the activeworkbook on demand. John;512523 Wrote: I may have 2 or 3 workbooks open, each has a custom print macro that is activated with Ctrl-P. However, Ctrl P does not call the macro from the active workbook. Seems like I read somewhere when there are duplicate shortcut keys, Excel calls macros from workbooks in alphabetical order. How can I force Excel to call the macro from the active workbook? Thank you. -- Simon Lloyd Regards, Simon Lloyd 'Microsoft Office Help' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=140789 |
Call macro from active workbook
Unless you have written code to override it, Ctl + P is the same as using
FilePrint from the menu bar or ActiveSheet.PrintOut from code. In other words, it uses the built in print command. There are no user developed print procedures involved, and no alphabetic selection of workbooks. The print command is at the application level, not the lower workbook level. "John" wrote in message ... I may have 2 or 3 workbooks open, each has a custom print macro that is activated with Ctrl-P. However, Ctrl P does not call the macro from the active workbook. Seems like I read somewhere when there are duplicate shortcut keys, Excel calls macros from workbooks in alphabetical order. How can I force Excel to call the macro from the active workbook? Thank you. |
Call macro from active workbook
Another thought. Even if you have overridden the application print command
with a user developed macro, the keyboard shortcut will call whatever was assigned to that shortcut when it was created, in the method defined by the code that the procedure executes. So there is still no alphabetic selection of workbooks. It selects what it is told to select by code. "John" wrote in message ... I may have 2 or 3 workbooks open, each has a custom print macro that is activated with Ctrl-P. However, Ctrl P does not call the macro from the active workbook. Seems like I read somewhere when there are duplicate shortcut keys, Excel calls macros from workbooks in alphabetical order. How can I force Excel to call the macro from the active workbook? Thank you. |
Call macro from active workbook
Try making a generic sub (which is the same in all workbooks) just to
capture the Ctrl+p and which then calls the "real" print macro in the activeworkbook. Sub PrintMeStarter() Application.Run (ActiveWorkbook.Name & "!PrintMe") End Sub You'll have to handle catching an error if the active workbook doesn't have a PrintMe() sub. Maybe just call the "regular" print in that case. Tim. "John" wrote in message ... I may have 2 or 3 workbooks open, each has a custom print macro that is activated with Ctrl-P. However, Ctrl P does not call the macro from the active workbook. Seems like I read somewhere when there are duplicate shortcut keys, Excel calls macros from workbooks in alphabetical order. How can I force Excel to call the macro from the active workbook? Thank you. |
All times are GMT +1. The time now is 05:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com