how do i print a list of files in ms word 2007

  • Thread starter Thread starter big joe
  • Start date Start date
Do you mean all of your Word documents or do you mean the names of the files
that comprise the program?
 
Either use the following macro, or download the Printfolders tool from my
web site

Sub FolderContents()
On Error GoTo err_FolderContents
Set NewDoc = Documents.Add
Dim DocList As String
Dim DocDir As String
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

Application.ScreenUpdating = False

With fDialog
.Title = "Select folder to save the copy and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , "List Folder Contents"
Exit Sub
End If
DocDir = fDialog.SelectedItems.Item(1)
If Right(DocDir, 1) <> "\" Then DocDir = DocDir + "\"
End With

DocList = Dir(DocDir & "*.doc", vbNormal)
Do While DocList <> ""
With Selection
.Style = "Normal"
.Font.name = "Times New Roman"
.Font.Size = "10"
.TypeText DocList & vbCr
End With
DocList = Dir
Loop

If NewDoc.Characters.Count = 1 Then
MsgBox "No documents found in selected folder", _
vbInformation, "No Data "
Exit Sub
End If
'Remove the next line if you do not want a two column layout
ActiveDocument.PageSetup.TextColumns.Add Width:=InchesToPoints(3)
ActiveWindow.ActivePane.View.Type = wdPageView

Application.ScreenUpdating = True
Exit Sub
err_FolderContents:
MsgBox Err.Description
Exit Sub
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
I have used a 3d party freeware product "DirPrint" to occasionally print a
list of files in a single directory. It worked well enough for the very
limited purpose I had in mind. There are some more advanced (and generally
free) products to print out more than a single directory or folder's
contents, such as showing the information in a "tree" structure, and you can
search for them.
 

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