View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Printing List Box Contents

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.

--
Regards,
Tom Ogilvy


"Martyn Jones" wrote in message
om...
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