|
|
Title | Use a VBA macro to number non-blank paragraphs in Word |
Description | This example shows how to let the user press Ctrl-A to select all of the text in a TextBox in Visual Basic 6. |
Keywords | ctrl-A, control-A, select text |
Categories | Office |
|
|
The NumberNonBlankParagraphs macro loops through the selected paragraphs and applies a number style to each that is non-blank.
|
|
' Number non-blank paragraphs.
Public Sub NumberNonBlankParagraphs()
Dim para As Paragraph
For Each para In Selection.Paragraphs
' See if the paragraph is empty.
If para.Range.Characters.Count > 1 Then
' It's not empty. Number it.
para.Range.ListFormat.ApplyListTemplate _
ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(5), _
_
ContinuePreviousList:=True
End If
Next para
End Sub
|
|
|
|
|
|