Ice-Tea-Jan
05-03-2011, 07:50 PM
Hello,
This forum has always helped me tremendously, and now I’m back again for more. :ipray:
In Word 2007, I need to target all story ranges with the “ConvertNumbersToText” method. I fully understand that this targets paragraphs that are numbered with the bullets & numbering dialog box, and the LISTNUM field. This is precisely what I want since I can then excerpt & copy certain sentences and still keep the numbers static.
I have two “newbie” macro samples below. The first is a one-liner and performs very fast, but I’m not sure it passes through every story type and every story instance.
The second macro was something I revised in order to get it to fly. (See the commented line where I inserted “ActiveDocument” ahead of “ConvertNumbersToText.”) Conversely, this runs VERY SLOW, and thus I’m pretty sure something is amiss.
Can somebody please advise me on how to pass “ConvertNumbersToText” so that is passes through each instance of each story type in a Word 2007 document?
:anyone:
Thanking you,
Janet
Sub ConvertNumbersToText()
'
ActiveDocument.ConvertNumbersToText
'
End Sub
Sub ConvertNumbersToTextInRanges()
'
Dim prange As Range, para As Paragraph
For Each prange In ActiveDocument.StoryRanges
Do
For Each para In prange.Paragraphs
ActiveDocument.ConvertNumbersToText 'Added ~ActiveDocument~ to get it to run
Next para
Set prange = prange.NextStoryRange
Loop Until prange Is Nothing
Next
End Sub
This forum has always helped me tremendously, and now I’m back again for more. :ipray:
In Word 2007, I need to target all story ranges with the “ConvertNumbersToText” method. I fully understand that this targets paragraphs that are numbered with the bullets & numbering dialog box, and the LISTNUM field. This is precisely what I want since I can then excerpt & copy certain sentences and still keep the numbers static.
I have two “newbie” macro samples below. The first is a one-liner and performs very fast, but I’m not sure it passes through every story type and every story instance.
The second macro was something I revised in order to get it to fly. (See the commented line where I inserted “ActiveDocument” ahead of “ConvertNumbersToText.”) Conversely, this runs VERY SLOW, and thus I’m pretty sure something is amiss.
Can somebody please advise me on how to pass “ConvertNumbersToText” so that is passes through each instance of each story type in a Word 2007 document?
:anyone:
Thanking you,
Janet
Sub ConvertNumbersToText()
'
ActiveDocument.ConvertNumbersToText
'
End Sub
Sub ConvertNumbersToTextInRanges()
'
Dim prange As Range, para As Paragraph
For Each prange In ActiveDocument.StoryRanges
Do
For Each para In prange.Paragraphs
ActiveDocument.ConvertNumbersToText 'Added ~ActiveDocument~ to get it to run
Next para
Set prange = prange.NextStoryRange
Loop Until prange Is Nothing
Next
End Sub