View Single Post
 
Old 04-24-2012, 07:39 PM
b0x4it b0x4it is offline Windows 7 32bit Office 2010 32bit
Advanced Beginner
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default Change all fields to just numbers in current page!

I have been using this code for a log time to convert all the fields of the document to just numbers:

Code:
Sub MMD_MakeAllReferencesToJustNumber()
    On Error Resume Next
    Dim oStoryRng As Range
    Dim oFld As Field
    For Each oStoryRng In ActiveDocument.StoryRanges
        For Each oFld In oStoryRng.Fields
            If oFld.Type = wdFieldRef Then
                If InStr(oFld.Code.Text, "\# 0;0") = 0 Then
                 oFld.Code.Text = Replace(oFld.Code.Text, " \h", " \# 0;0 \h")
                End If
             oFld.Update
            End If
        Next oFld
    Next oStoryRng
End Sub
but if the document is a long one with lots of field, then it takes long time to process all fields every time I run this code, because it updates all fields in the current document.

Now, I am wondering if it is possible to just update all the fields in the current page by changing

Code:
For Each oStoryRng In ActiveDocument.StoryRanges
to something just for the current page. I appreciate your help in this matter.
Thanks,
Reply With Quote