Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    May 2003
    Location
    Mid-Cheshire, England
    Posts
    275
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Macro to include number of copies option (MS Word

    I have recorded a macro to print page 1 then page 2 on a non-duplex printer. I would like to have a box appear when I click on the Print Page 1 or Page 2 buttons in which I can type the number of copies required. Can I be advised please on how to do this?

    This is the recorded macro:

    Sub Printpage1()
    '
    ' Printpage1 Macro
    ' Macro recorded Thursday, 28 April 2005 by ME Walker
    '
    Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
    wdPrintDocumentContent, Copies:=1, Pages:="1", PageType:=wdPrintAllPages, _
    Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
    PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
    End Sub
    Sub Printpage2()
    '
    ' Printpage2 Macro
    ' Macro recorded Thursday, 28 April 2005 by ME Walker
    '
    Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
    wdPrintDocumentContent, Copies:=1, Pages:="2", PageType:=wdPrintAllPages, _
    Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
    PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to include number of copies option (MS Word

    Try this:

    Sub Printpage1()
    '
    ' Printpage1 Macro
    ' Macro recorded Thursday, 28 April 2005 by ME Walker
    '
    Dim lngCopies As Long
    lngCopies = Val(InputBox("Enter the number of copies to be printed.", , "1"))
    If lngCopies <= 0 Then
    Exit Sub
    End If
    Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
    wdPrintDocumentContent, Copies:=lngCopies, Pages:="1", PageType:=wdPrintAllPages, _
    Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
    PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
    End Sub

    and similar for the other one.

  3. #3
    3 Star Lounger
    Join Date
    May 2003
    Location
    Mid-Cheshire, England
    Posts
    275
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Re: Macro to include number of copies option (MS W

    Thank you for your quick response. Once I grasped the difference between 1 (one) & l (ell) in lngCopies (the default font is TNR in my VB Editor) the improved macro worked AOK.

    Thank you again for your help - it is very much appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •