View Single Post
 
Old 03-27-2014, 07:03 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
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

Try it this way:
Code:
Sub GetAndRemoveSectionByInstanceNumber()
Dim ScnBrk As Long
With ActiveDocument.Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "Inst#: " & ReportInstance
      .Replacement.Text = ""
      .Forward = True
      .Wrap = wdFindStop
      .Format = False
      .MatchWildcards = True
      .Execute
    End With
    If .Find.Found = True Then
      With .Duplicate
        ScnBrk = .Sections(1).PageSetup.SectionStart
        .Sections(1).Range.Delete
        .Sections(1).PageSetup.SectionStart = ScnBrk
      End With
    End If
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote