' Macros de Word para ordinales (Marisa E Schieda) ' https://www.gonduana.com/mis-macros-de-word-para-ordinales-marisa-schieda Sub CorregirOrdinales() ' 1. Agrega punto entre cifra y ordinal (sin espacio entre ambos) With Selection.Find .Text = "([0-9])([ºª])" .Replacement.Text = "\1.\2" .Forward = True .Wrap = wdFindContinue .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll ' 2. Agrega espacio entre ordinal y palabra siguiente With Selection.Find .Text = "([0-9].[ºª])([a-zA-Z])" .Replacement.Text = "\1 \2" .Forward = True .Wrap = wdFindContinue .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll ' 3. Sustituye espacios entre cifra y ordinal por punto With Selection.Find .Text = "([0-9]) @([ºª])" .Replacement.Text = "\1.\2" .Forward = True .Wrap = wdFindContinue .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll ' 4. Corrige doble puntuación en ordinal With Selection.Find .Text = "([0-9].[ºª])(.)" .Replacement.Text = "\1" .Forward = True .Wrap = wdFindContinue .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll ' 5. Corrige casos frecuentes ' 5.a) 2.do, 2do y 2.da, 2da > 2.º/2.ª With Selection.Find .Text = "2.do" .Replacement.Text = "2.º" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "2do" .Replacement.Text = "2.º" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "2.da" .Replacement.Text = "2.ª" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "2da" .Replacement.Text = "2.ª" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' 5.b) 7.ma, 7ma y 7.mo, 7mo > 7.ª /7.º With Selection.Find .Text = "7.ma" .Replacement.Text = "7.ª" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "7ma" .Replacement.Text = "7.ª" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "7.mo" .Replacement.Text = "7.º" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "7mo" .Replacement.Text = "7.º" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' 6. Sustituye espacios entre ordinal y palabra siguiente por espacio de no separación With Selection.Find .Text = "([0-9].[ºª]) @([a-zA-Z ])" .Replacement.Text = "\1^s\2" .Forward = True .Wrap = wdFindContinue .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll End Sub