Sub StripBillingInfo()
On Error GoTo errorhandler
'set up variables
Dim SectionNumber As Integer
Dim RangeToSpike As Range
Dim AccumulatedText As String
'loop through sections
For SectionNumber = 1 To ActiveDocument.Sections.Count
'mark the first paragraph of the section, less the paragraph mark
Set RangeToSpike = _
ActiveDocument.Sections(SectionNumber).Range.Paragraphs.First.Range
RangeToSpike.MoveEnd wdCharacter, -1
If RangeToSpike.Start = RangeToSpike.End Then GoTo GetNextSection
If Mid(RangeToSpike.Text, 1, 3) <> "%%%" Then GoTo GetNextSection
'add the first paragraph to the spike, then delete it
RangeToSpike.MoveStart wdCharacter, 3
AccumulatedText = AccumulatedText & RangeToSpike.Text & vbCr
ActiveDocument.Sections(SectionNumber).Range.Paragraphs.First.Range.Delete
GetNextSection:
Next SectionNumber
'create a new document and dump the spike into it
Documents.Open FileName:="e:\billing.txt", ConfirmConversions:=False, Format:=wdOpenFormatText
Selection.EndKey wdStory
If Selection.Paragraphs.First.Range.Characters.Count > 1 Then
Selection.InsertParagraph
Selection.EndKey wdStory
End If
Selection.TypeText AccumulatedText
ActiveDocument.Close wdSaveChanges
errorhandler:
End Sub