PDA

View Full Version : Search paragraph and remove numbering



AyeSee
02-22-2011, 01:01 PM
Hi,

I have a paragraph that always starts by "For example," in which i need to remove numbering (Word's automatic numbering)... I have been trying for quite a while, but I can't seem to get the document to move the the desired paragraph. Aslo, I can't seem to get the condition working to only allow this to happen for paragraphs that start by "For example,". :banghead:

EX:
FROM

4. For example, the required [...]

TO

For example, the required [...]

Here is the code that I attempted to write in order to achieve this:

Dim RemoveNum As Word.Range
Set RemoveNum = ActiveDocument.Range
With RemoveNum.Find
.Text = "For example"
.MatchWholeWord = False
.MatchCase = True
While .Execute
With RemoveNum
If .InRange(RemoveNum) = "For example" Then
Selection.Range.ListFormat.RemoveNumbers NumberType:=wdNumberParagraph
With Selection.ParagraphFormat
.LeftIndent = InchesToPoints(0.5)
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
End With
End If
End With
Wend
End With
End Sub

Quite visibly, I am not understanding properly certain of these methods...

Many thanks in advance,
Alex

AyeSee
02-22-2011, 02:40 PM
hmmm how do i delete this thread, i just realised i accidently posted in the wrong page