Create a new macro and put this piece of code in it:
Sub adecuaFrases()
'
' Adecúa las frases de todo el documento. (Reformat all sentences in document)
' -Elimina los espacios iniciales y finales. (Deletes pre and post extra spacing)
' -Elimina el caracter '>' debidos a E-Mail (Deletes '> character due to E-Mail fwd)
Dim i As Long
trimSentences
i = 1
Do Until i > ActiveDocument.Sentences.Count
With ActiveDocument.Sentences(i).Characters
Select Case .First
Case ebcAttach
'->Eliminar la primera letra. (delete first character)
.First.Delete
Case Is <> UCase(.First)
'La primera letra es minuscula (If first letter is lowercase)
'->Eliminar el retorno de carro anterior. (delete carriage return)
ActiveDocument.Sentences(i).MoveStart
Selection.Start = ActiveDocument.Sentences(i).Start
Selection.Collapse
Selection.TypeBackspace
Selection.MoveLeft 1, wdCharacter
If Selection.Text = "." Then Selection.TypeText ","
Selection.TypeText ebcEspacio
Case Else
'Nada (do nothing)
i = i + 1
End Select
End With
Loop
End Sub
Excuse me if the name of the macro and all the coments are in Spanish. I'm afraid it's my native language. :)
'FOOTNOTE by moderator. I don't speak a single word spanish, except perhaps Yo qiero Taco Bell.
'but I attempted to make a few english comments out of it anyway.
Back to the matter, you will need also this sub:
Sub trimSentences()
Dim i As Integer
i = 1
Do While i <= ActiveDocument.Sentences.Count
ActiveDocument.Sentences(i).Text = Trim(ActiveDocument.Sentences(i).Text)
i = i + 1
Loop
End Sub
And that's all!!! The macro is ready to be tested. Just paste some text you may have received and launch the macro!
I hope you find useful this little macro. I did.
All sugestions will be welcome,
Thanks,
Carlos Iván
Comments