Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jul 2003
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel print must ask how many prints I want (Excel XP)

    The following code prints out a workbook on a printer. When I press the button I want a messagebox to appear wich asks how many copies I want. How can I add this to the code?

    Dim strSheetNames As String
    Dim intC As Integer
    With ActiveWorkbook
    For intC = 1 To .Worksheets.Count
    If .Worksheets(intC).Name <> "Berekening" Then _
    strSheetNames = strSheetNames & .Worksheets(intC).Name & ", "
    Next intC
    strSheetNames = Left(strSheetNames, Len(strSheetNames) - 2)
    Worksheets(Split(strSheetNames, ", ")).PrintOut _
    Copies:=1, ActivePrinter:="maxxus01HPColor", Collate:=True
    End With
    End Sub

    tnx

    Gerben (again)

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

    Re: Excel print must ask how many prints I want (Excel XP)

    Add this at the beginning:

    Dim intCopies As Integer
    intCopies = Application.InputBox("Enter number of copies to print", "Print", 1, , , , 1)
    If intCopies < 1 Then Exit Sub

    Replace Copies:=1 in the existing code by Copies:=intCopies

  3. #3
    Lounger
    Join Date
    Jul 2003
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel print must ask how many prints I want (Excel XP)

    Hans,

    Thanks, it's working perfectly.

    Gerben

Posting Permissions

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