Print Current Page Macro

C

CWilson

The recorded (in Word) macro below is designed to print the current
page of a document. While the macro works, it is extremely slow. The
macro selects a printer, sets other parameters, and prints the current
page. The printer selection is necessary because I print to several
different printers, and I don't want to have to select the printer
with File > Print each time. Additionally, most of the other
parameters are necessary for a number of reasons too lengthy to
explain here. It appears this line: ActivePrinter = "HP 4050
Development" causes the macro to be slow. If this line is removed, the
macro runs quickly. Can anyone help me determine why the macro is so
slow? Is there a way to edit the line: ActivePrinter = "HP 4050
Development" to eliminate the speed degradation it causes.

I am using Windows XP and Office XP (Word 2002).

Thanks in advance for any help.

Sub PrintCurrentPageDevelopmentPrinter()
'
' PrintCurrentPageDevelopmentPrinter Macro
' Macro recorded 12/2/2003
'
ActivePrinter = "HP 4050 Development"
Application.PrintOut FileName:="", Range:=wdPrintCurrentPage,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=False,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End Sub
 
E

Ebbe

Hey!


I use a similar functionality, and I have no problems with performance.
My code is slightly different:

Try this:

Sub PrintCurrentPageDevelopmentPrinter()
'
' PrintCurrentPageDevelopmentPrinter Macro
' Macro recorded 12/2/2003
'
Dim SaveActivePrinter As String

SaveActivePrinter = ActivePrinter

ActivePrinter = "HP 4050 Development"
Application.PrintOut FileName:="", Range:=wdPrintCurrentPage, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=False,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0,
_
PrintZoomPaperHeight:=0

ActivePrinter = SaveActivePrinter
End Sub

Ebbe
 
C

CWilson

To Ebbe:

Thanks for trying to help.

I tried the Macro you provided, that is, the lines that set the
current printer variable and restored it. I still have the same
problem. It's strange because this macro worked well with "Windows
2000 and Office XP." (I just recently changed my PC and am now running
Windows XP and Office XP.) I guess it could be a network issue, but I
can ping the printer's IP address with no problem. Also, choosing the
printer using File>Print>etc., is actually faster than running the
macro. Got any other suggestions.

Thanks again,
 
C

CWilson

To: Joe (1-21-04)

Thanks for your input.

We don't use a print server here, so I can't get the UNC path to work
as you suggested. I did try setting up the UNC path using my PC name
as the server name. It didn't work. The macro will run; however, the
print job doesn't reach the printer. I tried setting up the UNC path
using the IP address, but that didn't work either.

Any other suggestions? One would think that the macro should run as
quickly as choosing File, Print, Print Current Page. At least I am
hoping I can find a fix that will make it so.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top