Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default 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.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I call up a line of code that references a cell/range in theactive workbook workbook where I am running my macro from? Lav Excel Programming 2 November 11th 08 05:04 PM
need macro to call a workbook w/o the actual name of the workbook Jon Peltier Excel Programming 0 December 18th 06 10:01 PM
Call macro stored in Excel workbook from Outlook's macro Gvaram Excel Programming 0 October 4th 06 05:47 PM
How to call macro from other workbook ppyxl[_10_] Excel Programming 8 July 12th 06 04:33 PM
Call macro from active workbook-duplicate shortcut keys James[_18_] Excel Programming 1 January 16th 04 05:53 PM


All times are GMT +1. The time now is 02:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"