Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is there a difference between CTRL+D and CTRL+" (quotation marks) | Excel Discussion (Misc queries) | |||
How to make Ctrl-C, ctrl-V work in Office 2007 | Excel Discussion (Misc queries) | |||
Excel 2007: Ctrl+PgUp or Ctrl+PgDn with Protected Sheets | Excel Discussion (Misc queries) | |||
Redefining the Ctrl [ and Ctrl ]s short cut with OnKey? | Excel Programming | |||
Disabling Ctrl-PgUp and Ctrl-PgDn | Excel Programming |