Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/05/2007, 17:05
fero
 
Fecha de Ingreso: mayo-2007
Mensajes: 74
Antigüedad: 17 años
Puntos: 1
Re: Ideas para una macro de Word

Para borrar algo así:

Sub Macro1()

Dim str As String

Dim docActive As Document
Dim rng As Range
Dim nw As Integer

Set docActive = ActiveDocument
nw = ActiveDocument.Words.Count
i = 1

ciclo:
If i >= nw - 1 Then Exit Sub

str = docActive.Words(i)

If str <> Chr(13) Then
Set rng = docActive.Range(Start:=docActive.Words(i + 1).Start, _
End:=docActive.Words(nw).End)
rs = rng.Find.Execute(FindText:=str, Forward:=True, ReplaceWith:="", _
Replace:=wdReplaceAll, MatchWholeWord:=True)
nw = ActiveDocument.Words.Count
Set rng = Nothing
End If

i = i + 1

GoTo ciclo

End Sub