Forum Discussion

Mehmetbukum's avatar
Mehmetbukum
Copper Contributor
Sep 29, 2022

Edit index entries

i have got thousands index entries. can i edit { XE "joe" } as { XE "joe" \f "a"} by a macro

  • Mehmetbukum 

     

    You can use a macro to loop through the fields, let the macro check if the field type is XE and then take the required action.

     

    Should the \f "a" switch be added to all of your XE fields? Or is there some other pattern that can be specified? 

      • Stefan_Blom's avatar
        Stefan_Blom
        MVP

        Mehmetbukum 

         

        OK, since you want to modify all the XE fields, try the following: 

         

        Sub ModifyAllXEFields()
        'Stefan Blom, MVP, September 2022
        Dim f As Field
        For Each f In ActiveDocument.Fields
        If f.Type = wdFieldIndexEntry Then
        f.Code.Text = f.Code.Text & " \f ""a"""
        End If
        Next f
        End Sub

         

         

        For installation instructions, see http://www.gmayor.com/installing_macro.htm.

         

Resources