VBA:Remove All Bullet Point From Text Onto Table

Susanto3311
3StarLounger
Posts: 240
Joined: 17 Feb 2022, 05:16

VBA:Remove All Bullet Point From Text Onto Table

Post by Susanto3311 »

hi all.

i'm looking for code to remove all bullet point/numbering from a text into a table..
i have do with code both not work well

Code: Select all

Sub RemoveBulletsAndListBumbers()
  Dim objParagraph As Paragraph
  Dim objDoc As Document
 
  Application.ScreenUpdating = False
  Set objDoc = ActiveDocument
 
  For Each objParagraph In objDoc.Paragraphs
    If objParagraph.Range.ListFormat.ListType = WdListType.wdListBullet Or wdListSimpleNumbering Then
      objParagraph.Range.ListFormat.RemoveNumbers
    End If
  Next objParagraph
 
  Application.ScreenUpdating = True
  Set objDoc = Nothing
End Sub
here my attatchment document
thank in advance

susant
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: VBA:Remove All Bullet Point From Text Onto Table

Post by HansV »

Change

Code: Select all

    If objParagraph.Range.ListFormat.ListType = WdListType.wdListBullet Or wdListSimpleNumbering Then
to

Code: Select all

    If objParagraph.Range.ListFormat.ListType = WdListType.wdListBullet Or objParagraph.Range.ListFormat.ListType = wdListSimpleNumbering Then
Note: please use [code] and [/code] tags instead of [quote] and [/quote] tags for code.
Best wishes,
Hans

Susanto3311
3StarLounger
Posts: 240
Joined: 17 Feb 2022, 05:16

Re: VBA:Remove All Bullet Point From Text Onto Table

Post by Susanto3311 »

hi hans, i'm sorry..
thank you very much. working well!!