PC Review


Reply
 
 
=?Utf-8?B?SkJvdWx0b24=?=
Guest
Posts: n/a
 
      31st Oct 2007
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
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      31st Oct 2007
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I set ctrl+s and ctrl+o window size & ctrl+o save as type defa Moonbarker Osbourne Windows XP General 1 18th Jan 2008 02:10 PM
Shortcut keys like Ctrl+C, Ctrl+V, Ctrl+A etc Not Working gettechtips@yahoo.co.in Windows XP General 1 23rd Sep 2006 12:43 PM
Word 2003 go to start of document - ctrl home taking me to CTRL G =?Utf-8?B?bGVs?= Microsoft Word Document Management 3 12th Jul 2006 01:34 PM
How to enable Ctrl+C, Ctrl+V, Ctrl+X in textBoxes? kari Microsoft C# .NET 1 16th May 2006 02:19 AM
Re: VB script that mimics CTRL+C, CTRL+G, CTRL+V, ENTER? Fergus Cooney Microsoft VB .NET 0 8th Nov 2003 01:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:55 AM.