Hi Brad,
you are probably talking about deleting paragraphs,
which start with the pattern you indicated.
Not a beginner's question, even If it might seem to be simple.
Like this, if you can get it to work, you are not a beginner anymore:
Sub DeleteTimeDate()
Dim t As String ' time
Dim d As String ' date
Dim x As String ' time date seperator
Dim r As Range ' a range
Dim oPrg As Paragraph
For Each oPrg In ActiveDocument.Range.Paragraphs
Set r = oPrg.Range
r.Start = oPrg.Range.Start
r.End = oPrg.Range.Start + 21
t = Left(r, 8)
d = Right(r, 10)
x = Mid(r, 9, 3)
If _
IsTime(t) And _
IsDate(d) And _
IsSepr(x) _
Then
oPrg.Range.Delete
End If
Next
End Sub
Public Function IsTime(t As String) As Boolean
IsTime = False
On Error GoTo Ende
If t = CStr(CDate(t)) Then
IsTime = True
End If
Ende:
End Function
Public Function IsDate(d As String) As Boolean
IsDate = False
On Error GoTo Ende
If d = CStr(CDate(d)) Then
IsDate = True
End If
Ende:
End Function
Public Function IsSepr(x As String) As Boolean
IsSepr = False
On Error GoTo Ende
If x = " - " Then IsSepr = True
Ende:
End Function
Note that regional setting are important,
and can make this very complicated.
Of course, you could use a wildcard search, too.
But to me, it is very hard to read sometimes.
To avoid all possible bugs in wildcardsearch
and disregard regional settings, you could build your own grammar,
like:
2digits:2digits:2digits - 2 digits/2digits/4 digits
and check afterwards whether all is a possible time and date.
Greetings from Bavaria, Germany
Helmut Weber, MVP, WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"