ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Call macro - duplicate shortcut keys (https://www.excelbanter.com/excel-programming/288956-call-macro-duplicate-shortcut-keys.html)

John[_64_]

Call macro - duplicate shortcut keys
 
I'm still having problems with this. I usually have several workbooks open
at the same time, each with a
print macro with shortcut CTRL-P. When I press CTRL-P I want the print
macro from the active workbook to run. Often it will call the
procedure from a different (inactive) workbook, resulting in an error
message. Someone said to try thisworkbook but I couldn't get it to work
properly. How do make CTRL-P call the macro from the active workbook.




Jim Rech

Call macro - duplicate shortcut keys
 
The first workbook opened with a shortcut key assigned to a macro (via
Tools, Macro, Macros) gets to keep it. If the macros are all the same you
might change them so that they always operates on the active workbook, as
opposed to a named workbook or ThisWorkbook.

Sub MyPrint()
ActiveSheet.Printout
End Sub

--
Jim Rech
Excel MVP



John[_64_]

Call macro - duplicate shortcut keys
 
The macros have different dialog boxes. If I open a second workbook and
CTRL-P, the wrong dialog box is displayed (like you said, the first workbook
gets to keep it). Is there a way to display the dialog box from the active
workbook? There must be a workaround somehow.


"Jim Rech" wrote in message
...
The first workbook opened with a shortcut key assigned to a macro (via
Tools, Macro, Macros) gets to keep it. If the macros are all the same you
might change them so that they always operates on the active workbook, as
opposed to a named workbook or ThisWorkbook.

Sub MyPrint()
ActiveSheet.Printout
End Sub

--
Jim Rech
Excel MVP






All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com