Kamran
Kamran

Reputation: 4100

Word Macro to convert Bullets into simple Text

I am looking a way to convert the Bullets in Word document to simple text. E.g.

I have these kind of Bullets:

a)->      Apple
b)->      Orange
c)->      Mangoes

I want them to be like this:

a)Apple
b)Oranges
c)Mangoes

I am using this code but it removes the Bullets entirely:

Dim oPara As Paragraph

    For Each oPara In ActiveDocument.Paragraphs()
       Set r = oPara.Range
        If r.ListFormat.RemoveNumbers = wdListBullet Then
            r.ListFormat.ApplyListTemplate _
            ListTemplate:=ListGalleries(wdNumberGallery) _
                .ListTemplates(1)
        End If
        Set r = Nothing
     Next 

Upvotes: 0

Views: 745

Answers (1)

Christina
Christina

Reputation: 1379

Is ActiveDocument.ConvertNumbersToText what you're after?

It can also be run on a specific list if you're not doing this globally.

ETA: It seems like ConvertNumbersToText takes a NumberType argument (this isn't documented by the 2010 spec that F1 brings up, but it is valid). Perhaps the default doesn't apply to all the bullets in your document. A combination of the three possibilities might work.

ActiveDocument.ConvertNumbersToText(wdNumberParagraph) 'Preset numbers you can add to paragraphs by selecting a template in the Bullets and Numbering dialog box.
ActiveDocument.ConvertNumbersToText(wdNumberListNum) 'Default value for LISTNUM fields.
ActiveDocument.ConvertNumbersToText(wdNumberAllNumbers) 'Default value for all other cases.

I tend to use the first one, but your case might be different.

Upvotes: 1

Related Questions