DonCard
09-02-2004, 09:40 AM
I have tried using the following code that merges several separate docs into one. In my case, each separate doc is one full page. The code works but the resulting doc contains a blank page between each full page. Is there anyway to eliminate the blanks?
Sub MergeAll()
Dim wrd As Word.Application
Set wrd = CreateObject("word.application")
wrd.Visible = True
AppActivate wrd.Name
fname = Dir("C:\Documents and Settings\don\My Documents\MergeDocs\*.doc")
Do While (fname <> "")
With wrd
Selection.EndKey Unit:=wdStory
Selection.InsertBreak Type:=wdPageBreak
Selection.InsertFile FileName:=("C:\Documents and Settings\don\My Documents\MergeDocs\" & fname)
End With
fname = Dir
Loop
Set wd = Nothing
End Sub
Sub MergeAll()
Dim wrd As Word.Application
Set wrd = CreateObject("word.application")
wrd.Visible = True
AppActivate wrd.Name
fname = Dir("C:\Documents and Settings\don\My Documents\MergeDocs\*.doc")
Do While (fname <> "")
With wrd
Selection.EndKey Unit:=wdStory
Selection.InsertBreak Type:=wdPageBreak
Selection.InsertFile FileName:=("C:\Documents and Settings\don\My Documents\MergeDocs\" & fname)
End With
fname = Dir
Loop
Set wd = Nothing
End Sub