Microsoft Office Tutorials and References
In Depth Information
Converting AutoNumbered Text into Normal Text
Figure 49 – Reverse Numbering
View the Appendix to learn how to store this procedure
in a Standard module.
Option explicit¶
' * * * * *¶
Sub ReverseNumbering()¶
'Numbers the selected paragraphs¶
'in reverse order¶
'Variable declaration¶
Dim rngSel As Word.Range¶
Dim para As Word.Paragraph¶
Dim nrLines As Long¶
Dim separatorChars As String¶
'What should stand between the number¶
'and the paragraph text¶
separatorChars = "." & vbTab¶
Set rngSel = Selection.Range¶
'Determines the starting number¶
nrLines = rngSel.Paragraphs.Count¶
For Each para In rngSel.Paragraphs¶
'Insert the number info at the front¶
'of each paragraph¶
para.Range.InsertBefore CStr(nrLines) _¶
& separatorChars¶
'Get the next number¶
nrLines = nrLines - 1¶
'If using a tab, set the tabstop indent¶
If InStr(separatorChars, vbTab) Then¶
SetTabIndent rngSel, InchesToPoints(0.3)¶
'If using the metric system, comment¶
'out the above line and remove the comment¶
'from the following line¶
'SetTabIndent rngSel, CentimetersToPoint(0.6)¶
End If¶
End Sub¶
Search JabSto ::

Custom Search