HiBoo,
I think that code would work to print stand alone modules, which I can do, but I'm looking for something to print class modules. In answer to your question however, you can fill a list box using a function. I'll try to give you some direction from what I know.
You'll need to set up a module with two functions. One function will be used as to fill the list box and the other will be used to enumerate the fill list box function. Dump this code into a module:
Option Compare Database
Option Explicit
Public pubvarModuleList() As String
Public pubvarEntries
Function FillModuleList(fld As Control, id, row, col, code)
Dim retVal
Dim x As String
On Error GoTo ErrorHandler
retVal = Null
Select Case code
Case 0
pubvarEntries = 0
pubvarEntries = GetModuleNames(pubvarModuleList())
retVal = pubvarEntries
Case 1
retVal = Timer
Case 3
retVal = pubvarEntries
Case 4
retVal = 1
Case 5
retVal = -1
Case 6
retVal = pubvarModuleList(row)
Case 9
ReDim pubvarModuleList(0)
pubvarEntries = 0
End Select
FillModuleList = retVal
ErrorHandler:
Resume Next
End Function
Function GetModuleNames(names() As String)
Dim cntrModule As Container
Dim dbs As Database
Dim intArrayLength As Integer
Dim intVar As Integer
Set dbs = CurrentDb
intArrayLength = 0
Set cntrModule = dbs.Containers("Modules"

If cntrModule.Documents.Count <> 0 Then
intArrayLength = cntrModule.Documents.Count
ReDim pubvarModuleList(0 To cntrModule.Documents.Count - 1)
intVar = 0
For intVar = 0 To (intArrayLength) - 1
names(intVar) = cntrModule.Documents(intVar).Name
Next intVar
End If
GetModuleNames = intArrayLength
End Function
'-------
There's some text wrapping in this text box, but I'm sure you can figure out where everything goes.
Now in order for this to work, you have to select the listbox properties on the form you are working in. Then, set the listbox's RowSourceType to FillModuleList. If you use a command button to fill the list box, the code you would use in the command button click event to enumerate the list box is:
list0.requery
'----
list0 of course refers to the name of the listbox you want to display the module names in.
Hope that helps. Let me know.
Bernie