Printing a listBox

Nadia

Registered User.
Local time
Today, 05:37
Joined
Apr 17, 2012
Messages
77
hi every one ..

i am trying to print a listBox using:

Code:
Private Sub Sprint_Click()
Dim r As Integer 'rows
Dim c As Integer 'columns
With Forms.Dean.snames
For r = 0 To .ListCount - 1
For c = 0 To .ColumnCount - 1
Debug.Print .Column(c, r)
Next
Next
End With
End Sub

and it do nothing when clicking on Sprint button
help please ..
 
Your ListBox is likely driven by a query. Why not use DAO or ADO to run through the underlying recorset and print that?

EDIT: Saying that, your code works for me.
 
Last edited:
Your ListBox is likely driven by a query. Why not use DAO or ADO to run through the underlying recorset and print that?
it is, SQl statement written in the rowsource in properties
& because i don't know what is DAO neither ADO =D
EDIT: Saying that, your code works for me.

seems that codes are mean with me
 
Last edited:
Are you expecting it to show the Immediate Window as it prints when you click your form? It won't. If you click your button, your code should run, and you can check it in the Immediate Window afterwards.

However, this bit:

Code:
Forms.Dean.snames

What is Dean and what is snames? I'm guessing snames is your listbox. If Dean is your form name, then it should be Forms("Dean") or, if the listbox and command button are on the same form, then Me.snames
 

Users who are viewing this thread

Back
Top Bottom