Re: Grabbing previous numbered para
From: zivd (anonymous_at_discussions.microsoft.com)
Date: 09/04/04
- Next message: zivd: "Re: Cross-Reference dialog settings"
- Previous message: Joanne: "Re: Print all open docs"
- In reply to: Helmut Weber: "Re: Grabbing previous numbered para"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 4 Sep 2004 12:01:33 -0700
Thanks, Helmet. I'll give it a try!
>-----Original Message-----
>Hi,
>pretty, pretty complicated!
>It is assumed, that you search a selection, not a range.
>If you have found, what you have been searching for,
>then the selection is in 1 paragraph, probably.
>But I took care of that, too. (Msgbox)
>Then you have to check, whether this paragraph has an
automatic
>numbering. See Function IsAutoNumberedParagraph.
>If so, do nothing, otherwise loop through all preceeding
paragraphs
>backwards and check, whether the actual paragraph is
autonumbered.
>I used 0 for false, -1 for true and 9999999 for
undefinded, as usual.
>Good Luck, and remove the bugs and typos, I left behind.
>---
>Sub Test464()
>Dim i As Integer
>Dim oRng As Range
>Set oRng = Selection.Paragraphs(1).Range
>If IsAutoNumberedParagraph(oRng) = -1 Then
> Exit Sub
>End If
>oRng.Start = 0
>oRng.End = Selection.End
>For i = oRng.Paragraphs.Count To 1 Step -1
> If IsAutoNumberedParagraph(oRng.Paragraphs(i).Range)
Then
> oRng.Paragraphs(i).Range.Select
> Exit Sub
> End If
>Next
>End Sub
>Function IsAutoNumberedParagraph(oRng As Range) As Long
>Dim iLst As Integer
>If oRng.Paragraphs.Count > 1 Then
> MsgBox "More than 1 paragraph selected"
> IsAutoNumberedParagraph = 9999999
> Exit Function
>End If
>If oRng.ListParagraphs.Count = 0 Then
> IsAutoNumberedParagraph = 0
> Exit Function
>End If
>iLst = oRng.ListFormat.ListType
> Select Case iLst
> Case 1, 4, 5, 6: IsAutoNumberedParagraph = -1
> Case Else: IsAutoNumberedParagraph = 0
> End Select
>End Function
>Sub test111()
>MsgBox IsAutoNumberedParagraph(Selection.Range)
>End Sub
>---
>Greetings from Bavaria, Germany
>Helmut Weber, MVP
>"red.sys" & chr(64) & "t-online.de"
>Word XP, Win 98
>
>
>
>
>.
>
- Next message: zivd: "Re: Cross-Reference dialog settings"
- Previous message: Joanne: "Re: Print all open docs"
- In reply to: Helmut Weber: "Re: Grabbing previous numbered para"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|