Tengo hecha esta macro para buscar y reemplazar palabras desde un archivo específico, que en este caso es un documento de Word. Mi consulta es cómo hago para que en vez de un documento de word, tome el contenido de una lista de excel.
Éste es el código:
Sub ListaDeBalanceEspPort01()
Dim oChanges As Document, oDoc As Document Dim oTable As Table Dim oRng As Range Dim rFindText As Range, rReplacement As Range Dim i As Long Dim sFname As String sFname = "C:\Users\tini\Documents\SLAP\ESaPTinc.doc" Set oDoc = ActiveDocument Set oChanges = Documents.Open(FileName:=sFname, Visible:=False) Set oTable = oChanges.Tables(1) For i = 1 To oTable.Rows.Count Set oRng = oDoc.Range Set rFindText = oTable.Cell(i, 1).Range rFindText.End = rFindText.End - 1 Set rReplacement = oTable.Cell(i, 2).Range rReplacement.End = rReplacement.End - 1 With oRng.Find .ClearFormatting .Replacement.ClearFormatting Do While .Execute(findText:=rFindText, _ MatchWholeWord:=False, _ MatchWildcards:=False, _ Forward:=True, _ Wrap:=wdFindContinue) = True oRng.Text = rReplacement Loop End With Next i oChanges.Close wdDoNotSaveChanges End Sub
Gracias,
Sol