View Single Post
 
Old 09-04-2013, 07:33 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oCol As New Collection
Dim oColPN As New Collection
Dim oRng As Word.Range
Dim oDoc As Word.Document
Dim lngIndex As Long
Set oRng = ActiveDocument.Range
With oRng.Find
  .Text = "<[A-Z]{1,5}>"
  .MatchWildcards = True
  While .Execute
    On Error Resume Next
    oCol.Add oRng.Text, oRng.Text
    If Err.Number = 0 Then
      oColPN.Add oRng.Information(wdActiveEndPageNumber)
    End If
    On Error GoTo 0
    oRng.Collapse wdCollapseEnd
  Wend
End With
Set oDoc = Documents.Add
For lngIndex = 1 To oCol.Count
  oDoc.Range.InsertAfter oCol(lngIndex) & " " & oColPN(lngIndex) & vbCr
Next lngIndex
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote