ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing with a message (https://www.excelbanter.com/excel-programming/346101-printing-message.html)

Rmagic[_10_]

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


--
Rmagic
------------------------------------------------------------------------
Rmagic's Profile: http://www.excelforum.com/member.php...o&userid=28595
View this thread: http://www.excelforum.com/showthread...hreadid=486655


Tom Ogilvy

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" wrote in
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


--
Rmagic
------------------------------------------------------------------------
Rmagic's Profile:

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




Rmagic[_11_]

Printing with a message
 

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


Tom Ogilvy

Printing with a message
 
Notice the sample code did not have the "On Ne00"

--
Regards,
Tom Ogilvy


"Rmagic" wrote in
message ...

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





All times are GMT +1. The time now is 03:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com