Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 23rd, 2004, 03:00 PM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Printing specific pages from Word 2000

I have a 60,000 page Word 2000 document. There are 7,500 people who need four double sided pages printed front and back and then stapled.
What I want to do is send the file to my copier and have the pages individually printed and stapled for each of the 7,500 people. What I would like to do is create a macro that will send the first 8 pages and then the next 8 pages and so on. I have to do it this way because I can not send the entire document and have the copier staple each 8 pages by themselves, it would try to staple the whole document, which obviously wouldn't be possible nor is it what I want. Is there a way to do this in a Macro, such as using WdPrintFromTo? Or similar?
Thanks.
Jim

 
Old August 24th, 2004, 12:30 AM
Authorized User
 
Join Date: Feb 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Jim
Try the following, it should do the trick.

Sub PrintEight()
    Dim J As Long

    For J = 1 To 60000 Step 8
        ActiveDocument.ActiveWindow.PrintOut _
        Range:=wdPrintFromTo, From:=J, To:=J + 7
    Next J
End Sub

Cheers
Karsten


 
Old August 24th, 2004, 08:22 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Karsten.
Where in the current Macro would I put this?
Here is the current Macro.

Sub Pagerange()

'

' Pagerange Macro

' Macro recorded 8/23/2004 by Comp

'

    ActivePrinter = "Konica IP-601 PostScript"

    With Options

        .UpdateFieldsAtPrint = False

        .UpdateLinksAtPrint = False

        .DefaultTray = "Use printer settings"

        .PrintBackground = True

        .PrintProperties = False

        .PrintFieldCodes = False

        .PrintComments = False

        .PrintHiddenText = False

        .PrintDrawingObjects = True

        .PrintDraft = False

        .PrintReverse = False

        .MapPaperSize = True

    End With

    With ActiveDocument

        .PrintPostScriptOverText = False

        .PrintFormsData = False

    End With

    Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _

        wdPrintDocumentContent, Copies:=1, Pages:="1-8", PageType:= _

        wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _

        PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _

        PrintZoomPaperHeight:=0

End Sub


I created this so at least the first 8 double sided pages would print out with all the parameters. Right now this macro works perfectly, for the first 8 pages anyway!

How would I include your text? Thanks for your help, I really appreciate it....
Jim
Quote:
quote:Originally posted by slgknjn
 Hi Jim
Try the following, it should do the trick.

Sub PrintEight()
    Dim J As Long

    For J = 1 To 60000 Step 8
        ActiveDocument.ActiveWindow.PrintOut _
        Range:=wdPrintFromTo, From:=J, To:=J + 7
    Next J
End Sub

Cheers
Karsten


 
Old August 24th, 2004, 10:38 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also I am getting a Type Mismatch with the line:

ActiveDocument.ActiveWindow.PrintOut _
Range:=wdPrintFromTo, From:=J, To:=J + 7

It appears to be the Range:-wdPrintFromTo
the debugger is calling for a value?
Using an example of wdPrintFromTo=3
?
Please bear with me I am new to this. Thanks again.
Jim

 
Old August 24th, 2004, 11:16 PM
Authorized User
 
Join Date: Feb 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi
As it is not possible for me to print anything at the moment I can debug it myself. But look at this address here you can find all the information nessesary to perform your task.
http://msdn.microsoft.com/library/de...icationobj.asp

Cheers
Karsten

 
Old April 30th, 2005, 06:35 PM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gil fev Send a message via Yahoo to gil fev
Default

Quote:
quote:Originally posted by jpmhughes
 Thanks Karsten.
Where in the current Macro would I put this?
Here is the current Macro.

Sub Pagerange()

'

' Pagerange Macro

' Macro recorded 8/23/2004 by Comp

'

    ActivePrinter = "Konica IP-601 PostScript"

    With Options

        .UpdateFieldsAtPrint = False

        .UpdateLinksAtPrint = False

        .DefaultTray = "Use printer settings"

        .PrintBackground = True

        .PrintProperties = False

        .PrintFieldCodes = False

        .PrintComments = False

        .PrintHiddenText = False

        .PrintDrawingObjects = True

        .PrintDraft = False

        .PrintReverse = False

        .MapPaperSize = True

    End With

    With ActiveDocument

        .PrintPostScriptOverText = False

        .PrintFormsData = False

    End With

    Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _

        wdPrintDocumentContent, Copies:=1, Pages:="1-8", PageType:= _

        wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _

        PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _

        PrintZoomPaperHeight:=0

End Sub


I created this so at least the first 8 double sided pages would print out with all the parameters. Right now this macro works perfectly, for the first 8 pages anyway!

How would I include your text? Thanks for your help, I really appreciate it....
Jim
Quote:
quote:Originally posted by slgknjn
 Hi Jim
Try the following, it should do the trick.

Sub PrintEight()
    Dim J As Long

    For J = 1 To 60000 Step 8
        ActiveDocument.ActiveWindow.PrintOut _
        Range:=wdPrintFromTo, From:=J, To:=J + 7
    Next J
End Sub

Cheers
Karsten







Similar Threads
Thread Thread Starter Forum Replies Last Post
Command line printing to specific printers , trays sudarshan73 Reporting Services 0 January 23rd, 2007 03:51 PM
Printing all graphics in a specific subdirectory Larry Landis Beginning VB 6 0 December 9th, 2005 05:28 PM
How a Specific word in JTextArea can be selected mrafaqi Java GUI 1 February 2nd, 2005 10:08 PM
Printing pages ken killeen VB.NET 2002/2003 Basics 0 October 27th, 2004 07:31 AM
Heighlet Specific Word when open file in a browser salman Classic ASP Databases 1 March 30th, 2004 06:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.