View Single Post
 
Old 07-14-2011, 03:13 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi flds,

Change:
SubSctn As Section
to:
i As Long
and replace everything between:
'Check for Design Requirements in the source document
and:
'String variable for the output filenames
with:
Code:
    For Each Sctn In .Sections
      If InStr(UCase(Sctn.Range.Sentences.First), "DESIGN REQUIREMENT") > 0 Then
        Set Rng = Sctn.Range
        'Delete anything after the first 'Design Requirements' Section that isn't
        'also a 'Design Requirements' Section
        Rng.End = .Range.End
        For i = Rng.Sections.Count To 2 Step -1
          If InStr(UCase(Rng.Sections(i).Range.Sentences.First), "DESIGN REQUIREMENT") = 0 Then _
            Rng.Sections(i).Range.Delete
        Next
        'Cut the 'Design Requirement' Sections from the source document
        'and paste them into a new design requirements document
        Rng.Cut
        Set DocDesReq = Documents.Add(Visible:=False)
        'Process the new document
        Call NewDoc(DocDesReq)
        Exit For
      End If
    Next Sctn
    Call Cleanup(.Range)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 07-14-2011 at 03:17 PM. Reason: Code refinements
Reply With Quote