I can't quite get the syntax for printing to the manual feed tray

  • Thread starter Sharlene England
  • Start date
S

Sharlene England

Below is my code, and the escape sequence is correct as it does work in an
old wordperfect macro, but in excel this printout never goes to the correct
tray, any ideas?

Thanks.

ActiveSheet.PageSetup.PrintArea = "$A$1:$U$52"
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.45)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.73)
.BottomMargin = Application.InchesToPoints(0.4)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.43)
.PrintQuality = 600
End With

' selects the manual page tray without printing
SendKeys "{ESC}&l8H"
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True
 
T

Tom Ogilvy

Send keys goes to the activewindow.

You would have to use low level file io to write to the printer.

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 ine " + 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.

You would need to send you sequence to the printer.

All that said, I am not sure that will work if you then try to print through
windows using Printout. I believe that will go through the print driver and
send new settings (those selected in the print driver/print setup) to the
printer. However, it shouldn't be hard to test.



Regards,
Tom Ogilvy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Print area - selection 4
Slow PageSetup macro 3
Page setup too slow 2
Printing Setup help 9
Slow Macro - Formatting Macro 1
page setup preferances 2
Setting Print Range 2
Define a Variable 1

Top