M
mharris357
I have been using the following macro to unmerge a long document and
create 6 labeled documents in same folder, but it does not warn about
overwriting an existing file. I would appreciate advise on how to add
that function.Thanks in advance!
Sub UnMerge()
Dim docNew As Word.Document
Dim sctsActive As Word.Sections
Dim astrFiles(1 To 6) As String
Dim i As Long
astrFiles(1) = "Label.doc"
astrFiles(2) = "Address.doc"
astrFiles(3) = "Data Entry.doc"
astrFiles(4) = "Rep.doc"
astrFiles(5) = "AppFile.doc"
astrFiles(6) = "Application.doc"
Set sctsActive = Word.ActiveDocument.Sections
For i = 1 To 6
Set docNew = Documents.Add
With docNew
sctsActive(i).Range.Copy
.Range.Paste
.SaveAs astrFiles(i)
End With
Next i
End Sub
create 6 labeled documents in same folder, but it does not warn about
overwriting an existing file. I would appreciate advise on how to add
that function.Thanks in advance!
Sub UnMerge()
Dim docNew As Word.Document
Dim sctsActive As Word.Sections
Dim astrFiles(1 To 6) As String
Dim i As Long
astrFiles(1) = "Label.doc"
astrFiles(2) = "Address.doc"
astrFiles(3) = "Data Entry.doc"
astrFiles(4) = "Rep.doc"
astrFiles(5) = "AppFile.doc"
astrFiles(6) = "Application.doc"
Set sctsActive = Word.ActiveDocument.Sections
For i = 1 To 6
Set docNew = Documents.Add
With docNew
sctsActive(i).Range.Copy
.Range.Paste
.SaveAs astrFiles(i)
End With
Next i
End Sub