Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Printing Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Patrick C. Simonds - 01 Apr 2008 00:23 GMT
I have this code located under  ThisWorkbook to intercept a print request,
and run my code to print multiple copies. Now I know most of you will say
"why not just set the #of copies" well the problem is when I do that our
Color Laser will print lines in the merged cells where the boarder would be
if the cells were not merged, but if I print one at a time it does not do it
(very strange behavior, but IT will not replace my print just for that). I
am at a loss here. So how can I loop through the multiple print routines
without triggering the BeforePrint code?

Private Sub Workbook_BeforePrint(Cancel As Boolean)

On Error GoTo EndPoint

Printing.Show

'EndPoint:
   Cancel = True

EndPoint:

End Sub

---------------------------------------------------------

This code is in it's own module (not located under  ThisWorkbook )

Private Sub CommandButton1_Click()

SortRoutesToCover.SortRoutesToCover

If OptionButton1.Value = True Then

   ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
       "Paratransit_Color_Laser on Ne01:", Collate:=True

   Unload Printing

ElseIf OptionButton2.Value = True Then

   ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
       "Paratransit_Color_Laser on Ne01:", Collate:=True

   ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
       "Paratransit_Color_Laser on Ne01:", Collate:=True

   Unload Printing

End If

End Sub
Patrick C. Simonds - 01 Apr 2008 00:38 GMT
Just figured it out after hours of frustration.  Adding
Application.EnableEvents on both ends of the code was all it took.

Application.EnableEvents = False

ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
       "Paratransit_Color_Laser on Ne01:", Collate:=True

Application.EnableEvents = True

>I have this code located under  ThisWorkbook to intercept a print request,
>and run my code to print multiple copies. Now I know most of you will say
[quoted text clipped - 46 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.