I post here the solution as Doug has finally found it. The issue was related with "hidden" headings from previous changes on the document that were not accepted. So when inserting a cross reference to an index of the Headings array the macro failed.
I could fix it manually just selecting Track Changes : Original Showing Markup
And then accepting all changes
By code I modified the macro so from now on it makes this automatically:
' Track changes : Original Showing Markup
With ActiveWindow.View
.RevisionsView = wdRevisionsViewOriginal
.RevisionsView = wdRevisionsMarkupAll
End With
' Accept all changes in document
ActiveDocument.Revisions.AcceptAll
Thanks a lot Doug for your help!