Printing List Box Contents

  • Thread starter Thread starter Martyn Jones
  • Start date Start date
M

Martyn Jones

Hi

Is there a way in Excel (VBA Code) to print to contents of a list box?

For example, I have an application that lists some financial figures
in a list box. Is there a way of sending these figures to a printer?

Martyn
 
Easiest would be to write them to a worksheet and print the range where they
are written.

An alternative is to use low level file io (guess it depends on what you are
actually doing)

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

If the printer is on a network, you would have to replace the LPT1 with the
network name.
 

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

Back
Top