S
sals
I have this code to extract files from one folder and to combine them
into one large document. Each file has a text boxes at the top of the
document, inside it, there are text with different styles and font
sizes. Once I merge them togehter, some of the font sizes changed
from 10 to 12 and is causing the text to be scattered and expanded
every where.
How do I get all the text and format to stay exactly the same?
Or is there a better approach at this?
Thanks,
S
_____________________________________________________________
Sub mergeDoc()
activeDir = "F:\doc"
With Application.FileSearch
.LookIn = activeDir 'folder with old files
End With
'move to the end of the document to insert files
Selection.EndKey Unit:=wdStory, Extend:=wdMove
With Application.FileSearch
.NewSearch
.LookIn = activeDir
.SearchSubFolders = False
.FileName = "*.doc"
.MatchTextExactly = False
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Selection.InsertFile FileName:=.FoundFiles(i),
Range:="", _
ConfirmConversions:=False, Link:=False,
Attachment:=False
Selection.InsertBreak Type:=wdSectionBreakOddPage
Next i
'Remove Final Section Break
Selection.EndKey Unit:=wdStory
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
End With
End Sub
into one large document. Each file has a text boxes at the top of the
document, inside it, there are text with different styles and font
sizes. Once I merge them togehter, some of the font sizes changed
from 10 to 12 and is causing the text to be scattered and expanded
every where.
How do I get all the text and format to stay exactly the same?
Or is there a better approach at this?
Thanks,
S
_____________________________________________________________
Sub mergeDoc()
activeDir = "F:\doc"
With Application.FileSearch
.LookIn = activeDir 'folder with old files
End With
'move to the end of the document to insert files
Selection.EndKey Unit:=wdStory, Extend:=wdMove
With Application.FileSearch
.NewSearch
.LookIn = activeDir
.SearchSubFolders = False
.FileName = "*.doc"
.MatchTextExactly = False
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Selection.InsertFile FileName:=.FoundFiles(i),
Range:="", _
ConfirmConversions:=False, Link:=False,
Attachment:=False
Selection.InsertBreak Type:=wdSectionBreakOddPage
Next i
'Remove Final Section Break
Selection.EndKey Unit:=wdStory
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
End With
End Sub