Combing half-page documents into one large document

E

emailtoalex

Hi,

I have hundreds of half-page documents (each of them has only a few
lines) and I would like to combine them, one immediately after
another, so that I can print the combined document out without a lot
of white space.

I have searched and found this VBA code:

http://word.mvps.org/FAQs/MacrosVBA/PrintAllDocsInFldr.htm

However it prints each document individually and the result is a waste
of paper because each file only has a few lines in it.

Thanks!

Alex
 
D

Doug Robbins - Word MVP

Use the following:

Dim MyPath As String
Dim MyName As String
Dim Mydoc As Document, NewDoc As Document
Dim docrange As Range

'Create a new document
Set NewDoc = Documents.Add
'let user select a path
With Dialogs(wdDialogCopyFile)
If .Display() <> -1 Then Exit Sub
MyPath = .Directory
End With

'strip quotation marks from path

If Len(MyPath) = 0 Then Exit Sub

If Asc(MyPath) = 34 Then
MyPath = Mid$(MyPath, 2, Len(MyPath) - 2)
End If

'get files from the selected path
'and insert them into the doc
MyName = Dir$(MyPath & "*.*")
Do While MyName <> ""
Set Mydoc = Documents.Open(MyName)
Set docrange = Mydoc.Range
NewDoc.Range.InsertAfter docrange.FormattedText
Mydoc.Close wdDoNotSaveChanges
MyName = Dir
Loop
'NewDoc should now contain all of the other documents

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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

Top