Wildcards are strictly for people with brains, and sometimes, having
burned one's brains out, they burn the brain out of one's machine to
boot.
Anyway, you might try this humbler approach as an alternative. It
doesn't search for anything. It goes down paragraph by paragraph
skipping empty paragraphs, paragraphs that don't contain a tab, and
paragraphs where the text that precedes the tab contains no dots.
When it finds a number followed by a tab, it counts the dots therein
using a trick more or less stolen from Dave Lett - more, actually.
(Dave is the ranking master of the Replace function.)
Then it expands the range to include the tab, deletes the tab and text
numbers, and applies the appropriate numbering style to the paragraph.
Heading styles are used here; you can substitute your Para styles.
Hope you'll find some value in it.
Sub GoingDotty()
Dim R As Range, P As Paragraph, WithDots As Byte, WithoutDots As Byte,
DotCnt As Byte
For Each P In Selection.Range.Paragraphs
Set R = P.Range
If R.Characters.Count = 1 Then GoTo EndLoop
R.End = R.Start
R.MoveEndUntil vbTab
If InStr(R.Text, vbCr) > 0 Then GoTo EndLoop
If InStr(R.Text, ".") = 0 Then GoTo EndLoop
WithDots = Len(R.Text)
WithoutDots = Len(Replace(R.Text, ".", ""))
DotCnt = WithDots - WithoutDots
If R.Characters.Last <> "." Then DotCnt = DotCnt + 1
R.End = R.End + 1
R.Delete
P.Style = "Heading " & DotCnt
EndLoop:
Next
End Sub
> Hello again,
>
[quoted text clipped - 7 lines]
>
> Dan
Dan - 28 Jan 2005 14:57 GMT
That seems like a more efficient method of doing what I'm trying to do.
I will give it a try.
Thank you so much!
Dan