![]() |
ctrl-p
I use this code to test for workbook name and run the appropriate print
routine. How can I call the regular Excel ctrl-p for workbooks that are not part of my project instead of just a beep at the end? Sub ProjectPrint() ' ' Keyboard Shortcut: Ctrl+p Dim FileName As String, Length As Integer, FileClass As String On Error GoTo EndIt FileName = ActiveWorkbook.name Length = Len(FileName) FileClass = Left(FileName, Length - 4) Length = Len(FileClass) FileClass = Right(FileClass, Length - 4) ProcName = "Do" + FileClass + "Print" Run ProcName End EndIt: Beep End Sub TIA, Jim |
ctrl-p
I'd just use a different shortcut key:
ctrl-shift-p (ctrl-P) for your code. Without knowing how you determine if a workbook is part of your project, maybe you could go by name: Select case lcase(activeworkbook.name) case is = "book1.xls", "book99.xls" 'do your macro case else activewindow.selectedsheets.printout 'preview:=true 'for testing?? end select (untested, uncompiled.) JBoulton wrote: I use this code to test for workbook name and run the appropriate print routine. How can I call the regular Excel ctrl-p for workbooks that are not part of my project instead of just a beep at the end? Sub ProjectPrint() ' ' Keyboard Shortcut: Ctrl+p Dim FileName As String, Length As Integer, FileClass As String On Error GoTo EndIt FileName = ActiveWorkbook.name Length = Len(FileName) FileClass = Left(FileName, Length - 4) Length = Len(FileClass) FileClass = Right(FileClass, Length - 4) ProcName = "Do" + FileClass + "Print" Run ProcName End EndIt: Beep End Sub TIA, Jim -- Dave Peterson |
All times are GMT +1. The time now is 03:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com