+ Reply to Thread
Results 1 to 4 of 4

Printing with a message

  1. #1
    Registered User
    Join Date
    11-06-2005
    Posts
    13

    Printing with a message

    Hello

    I have a form that inputs data into a sheet then you click a button to print 2 copies (one on a green sheet and one on a white sheet)

    BUT Is it poss before printing a message box to appear and ask the user to insert the "white copy" then after printing a second message box to appear asking the user to insert "Green copy"

    Is it also poss for a macro to control a printer and make it form feed the sheets the reason is when printing the white and green copy you have to form feed them and when you print from any other program or a different excel sheet it prints from the paper tray. I know that this is a long shot!!!!

    Thanks

  2. #2
    Tom Ogilvy
    Guest

    Re: Printing with a message

    You can try sending a form feed character to the printer (chr(12) as I
    recall)

    msgbox "White paper"
    ActiveSheet.Printout
    msgbox "Green paper"
    ActiveSheet.Printout

    Here is information from an old post on printing directly that you can adapt
    to sending a form feed (it already includes a form feed in the demo).

    --------------------------
    Actually you don't need to create a text file. You can write to the
    printer, same as writing to the file: the below prints several lines, but
    you should be able to adapt it to your situation.


    Sub Macro5()
    Dim ctrl as Long
    Dim tmpstr as String
    Open "LPT1:" For Output As #1
    Print #1, "[Start of Printing Test]"
    For ctrl = 1 To 10
    tmpstr = "Printing:" + Str(ctrl)
    Print #1, tmpstr
    Next
    tmpstr = "[End of printing test]" + Chr(12)
    Print #1, tmpstr
    Close #1
    End Sub


    To a Network printer


    First, I went to the immediate window in the VBE to query the activeprinter
    string


    ? activePrinter
    \\ARDAPS01\1D343E on Ne02:


    then I used the first part in the below code:


    Sub Macro5()
    Dim ctrl As Long
    Dim tmpstr As String
    Open "\\ARDAPS01\1D343E" For Output As #1
    Print #1, "[Start of Printing Test]"
    For ctrl = 1 To 10
    tmpstr = "Printing Line " + Str(ctrl)
    Print #1, tmpstr
    Next
    tmpstr = "[End of printing test]" + Chr(12)
    Print #1, tmpstr
    Close #1
    End Sub


    Worked for me.

    ---------------

    --
    Regards,
    Tom Ogilvy



    "Rmagic" <Rmagic.1yswim_1132499402.201@excelforum-nospam.com> wrote in
    message news:Rmagic.1yswim_1132499402.201@excelforum-nospam.com...
    >
    > Hello
    >
    > I have a form that inputs data into a sheet then you click a button to
    > print 2 copies (one on a green sheet and one on a white sheet)
    >
    > BUT Is it poss before printing a message box to appear and ask the user
    > to insert the "white copy" then after printing a second message box to
    > appear asking the user to insert "Green copy"
    >
    > Is it also poss for a macro to control a printer and make it form feed
    > the sheets the reason is when printing the white and green copy you
    > have to form feed them and when you print from any other program or a
    > different excel sheet it prints from the paper tray. I know that this
    > is a long shot!!!!
    >
    > Thanks
    >
    >
    > --
    > Rmagic
    > ------------------------------------------------------------------------
    > Rmagic's Profile:

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




  3. #3
    Registered User
    Join Date
    11-06-2005
    Posts
    13

    still get error

    hi
    Thanks for code

    I have tried but get a "Run time error 52"

    The code

    Sub Macro5()
    Dim ctrl As Long
    Dim tmpstr As String
    Open "EPSON Stylus CX3200 on Ne00:" For Output As #1
    Print #1, "[Start of Printing Test]"
    For ctrl = 1 To 10
    tmpstr = "Printing:" + Str(ctrl)
    Print #1, tmpstr
    Next
    tmpstr = "[End of printing test]" + Chr(12)
    Print #1, tmpstr
    Close #1
    End Sub


    Thanks for the help

  4. #4
    Tom Ogilvy
    Guest

    Re: Printing with a message

    Notice the sample code did not have the "On Ne00"

    --
    Regards,
    Tom Ogilvy


    "Rmagic" <Rmagic.1ytf1a_1132523402.0425@excelforum-nospam.com> wrote in
    message news:Rmagic.1ytf1a_1132523402.0425@excelforum-nospam.com...
    >
    > hi
    > Thanks for code
    >
    > I have tried but get a "Run time error 52"
    >
    > The code
    >
    > Sub Macro5()
    > Dim ctrl As Long
    > Dim tmpstr As String
    > Open "EPSON Stylus CX3200 on Ne00:" For Output As #1
    > Print #1, "[Start of Printing Test]"
    > For ctrl = 1 To 10
    > tmpstr = "Printing:" + Str(ctrl)
    > Print #1, tmpstr
    > Next
    > tmpstr = "[End of printing test]" + Chr(12)
    > Print #1, tmpstr
    > Close #1
    > End Sub
    >
    >
    > Thanks for the help
    >
    >
    > --
    > Rmagic
    > ------------------------------------------------------------------------
    > Rmagic's Profile:

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




+ 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