+ Reply to Thread
Results 1 to 6 of 6

Print number of copies box

  1. #1
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196

    Print number of copies box

    Hello Programmers!

    I have this code to print a portion of a worksheet.

    Sub PrintLogsheet()
    '
    Application.ScreenUpdating = False
    Range("A1:M37").Select
    Selection.PrintOut Copies:=1, Collate:=True
    Range("A1").Select
    Application.ScreenUpdating = True
    End Sub


    How do I insert code, that when I click the macro button, a box pops up asking how many copies to print? After entering the required amount, click OK, then the code continues out to print the copies.

    Thanks,
    EMoe

  2. #2
    Duncan
    Guest

    Re: Print number of copies box

    Hello,

    The following is some code that i put together to print out copies of a
    merge after running a find to show the right one. maybe if you altered
    this a bit you get it to do what you want? not sure mind, might be a
    better way. (P.s im probly gonna get a caning for using the GoTo
    command but then im not really much of a developer just a simple
    bloke!) (P.s it loops until you press cancel)



    ln18:
    Documents("Test Merge TP1.doc").Activate
    WordBasic.mailmergefindentry
    Documents("Test Merge TP1.doc").Activate

    ' this lot is a message box to print it or not
    Dim prompt, title, response
    Dim style As Integer
    prompt = "Would you like to print this TP1?
    Yes = Print, No = Search again, Cancel = Close"
    style = vbYesNoCancel + vbQuestion
    title = "Print?"
    response = MsgBox(prompt, style, title)
    If response = vbYes Then
    ActiveDocument.PrintOut
    GoTo ln18
    Else
    If response = vbNo Then
    GoTo ln18
    Else
    If response = vbCancel Then
    ActiveDocument.Protect
    wdAllowOnlyFormFields, no, ""
    Documents("Test Merge TP1.doc").Close (no)
    Documents("Print.doc").Activate

    End If

    End If

    End If


  3. #3
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196
    Thanks Duncan, I will look over what you've submitted.

    EMoe

  4. #4
    Tom Ogilvy
    Guest

    Re: Print number of copies box

    Sub PrintLogsheet()
    Dim num as String
    num = InputBox("enter number of copies")
    if num = "" then
    num = 1
    elseif not isnumeric(num) then
    num = 1
    end if
    Application.ScreenUpdating = False
    Range("A1:M37").Select
    Selection.PrintOut Copies:=clng(num), Collate:=True
    Range("A1").Select
    Application.ScreenUpdating = True
    End Sub



    "EMoe" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hello Programmers!
    >
    > I have this code to print a portion of a worksheet.
    >
    > Sub PrintLogsheet()
    > '
    > Application.ScreenUpdating = False
    > Range("A1:M37").Select
    > Selection.PrintOut Copies:=1, Collate:=True
    > Range("A1").Select
    > Application.ScreenUpdating = True
    > End Sub
    >
    > How do I insert code, that when I click the macro button, a box pops up
    > asking how many copies to print? After entering the required amount,
    > click OK, then the code continues out to print the copies.
    >
    > Thanks,
    > EMoe
    >
    >
    > --
    > EMoe
    > ------------------------------------------------------------------------
    > EMoe's Profile:

    http://www.excelforum.com/member.php...o&userid=23183
    > View this thread: http://www.excelforum.com/showthread...hreadid=491788
    >




  5. #5
    Tom Ogilvy
    Guest

    Re: Print number of copies box

    > Thanks Duncan, I will look over what you've submitted.

    You wanted to print a word document? Sorry, I missed that in your initial
    post.

    --
    Regards,
    Tom Ogilvy



    "EMoe" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Thanks Duncan, I will look over what you've submitted.
    >
    > EMoe
    >
    >
    > --
    > EMoe
    > ------------------------------------------------------------------------
    > EMoe's Profile:

    http://www.excelforum.com/member.php...o&userid=23183
    > View this thread: http://www.excelforum.com/showthread...hreadid=491788
    >




  6. #6
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196
    Thanks Tom, this is exactly what I needed. I tried it and it works great.

    Thanks again too for all your help in my many previous threads.

    Regards,
    EMoe

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1