VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

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

VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

hi all..

I have a word document with automatic numbering and bulleting. I need VBA to convert automating numbering and/or bulleting to normal text.
i found macro code in internet like this below.

Code: Select all

Sub convertNumbersAndBulletsToText()
   Dim myRange As Range
   Set myRange = Selection.Range
   myRange.ListFormat.ConvertNumbersToText
End Sub
i want to modified that code should work like this:
1. when i running new macro code (after modified), automatic make numbering/bulleting convert to as normal text and DON'T show shading background (please see picture before or after code, display grey background.
2. i want the new document not change formatting text, font, size & paragraph, etc..after running macro
3. if possible macro work automatic selected all text/document without selected manually.
4. the macro/vba can save as Ms Word Add-Ins. (personal add ins)

any help, thank in advance.
susanto
You do not have the required permissions to view the files attached to this post.

User avatar
Charles Kenyon
5StarLounger
Posts: 615
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Charles Kenyon »

I do not understand the question.
The macro you have listed removes the field-type shading and will not change fonts unless you have something else going on with styles.

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

hi...
from first paragraph (before running macro as sample) as original text that contains numbering/bullet and show "Grey" background in number
the second paragraph as new file after running macro has modified, i want not show "grey" background in number (normal text)
sorry, forget for point 2 in my first post
Last edited by Susanto3311 on 27 Feb 2022, 17:09, edited 1 time in total.

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by HansV »

Try

Code: Select all

Sub ConvertNumbersAndBulletsToText()
   Dim par As Paragraph
   For Each par In ActiveDocument.ListParagraphs
       par.Range.ListFormat.ConvertNumbersToText
    Next par
End Sub
Best wishes,
Hans

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

hi Hans, thank but still a problem,
the final result (after run your code) the spacing have change
please, see attachment file.
i want not change space
You do not have the required permissions to view the files attached to this post.

User avatar
Charles Kenyon
5StarLounger
Posts: 615
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Charles Kenyon »

The result you are getting is a result of the paragraph settings in the styles you are using. It is not a result of, nor controlled by, the vba.

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

Ok, guys.
Thanks Hans & Charles Kenyon

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

hi...
the code work properly, but i want to modified like this;
- using button as ms word add-ins, when first time 1 click button, code running CONVERT numbering, when click again in the same button code running to UNCONVERT numbering (back to normally format)

Code: Select all

Sub ConvertNumbersAndBulletsToText()
   Dim par As Paragraph
   For Each par In ActiveDocument.ListParagraphs
       par.Range.ListFormat.ConvertNumbersToText
    Next par
End Sub
i would like someone give me solution.

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by HansV »

Best wishes,
Hans

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

Hi Hans, thanks I will try.
Actually I,m confused how to modified the code with that link you suggest.

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by HansV »

What is the purpose of all this? Why would you want to toggle automatic numbering off and then on again?
Best wishes,
Hans

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

hi Hans..
Let me i tell you what my purpose:
i have use web office software (intern/private app) for easy called "SmartOff". this app is web base with connecting internet to use it. this app work like Word Processor like Ms Word. You can typing into "Smartoff" template available or use MS Word as alternative with uploading (use copy documnet from Ms Word then pasting into SmartOff app). I have choice using copy paste document as method. from here occur problem, if when i use Ms Word as method often the result after loading in SmartOff app not same display with the source document (MS word)..

for to trick this problem, i try that MS Word document before upload (copy paste) MUST clear & clean from any format include specialist Bullet/Numbering...If document ms word still contains Bullet/Numbering that can't upload.
for clearing format, i have use your above code...

i don't know how to fix this problem..
the problem, sometime show increase paragraf is not precision, numbering is not precision position, problem in spacing (not same spacing) from source/original document.
perhaps, only document that free & clear from formatting can successfuly to copy paste into my web app.
maybe , you have solution
i have trying using another Writer like WPS Office, Atlantis etc...but not fully working (not always stable & precision display after upload/copy paste)
and if possible i want use only MS Word as processing.
this picture maybe more information
You do not have the required permissions to view the files attached to this post.
Last edited by Susanto3311 on 09 Mar 2022, 16:36, edited 1 time in total.

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by HansV »

I'm afraid this is above my pay grade. I hope that a Word VBA expert can help you with this.
Best wishes,
Hans

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

ok no problem, Hans.
you have a lot of helping me...

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Susanto3311 »

hi Hans...
i think your code is helped me...if this possible, would you make to toggle automatic numbering off and then on again?

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

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by HansV »

You want the document to look exactly the same before and after. I don't know how to accomplish that.
Best wishes,
Hans

User avatar
Charles Kenyon
5StarLounger
Posts: 615
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: VBA : Convert Automating Numbering and/or Bulleting to Normal Text.

Post by Charles Kenyon »

Susanto3311 wrote:
09 Mar 2022, 16:54
hi Hans...
i think your code is helped me...if this possible, would you make to toggle automatic numbering off and then on again?
Simplest thing to do is turn it off in a COPY, saving your original.