VBA Loop through excel Cells from Word Document and change text in Word Document

Hi I am Using This Macro

I want to Loop through a Colomn of Sheet 2 of Excel Workbook Marketing.xls

From C2 to C67

and I want to change the word in “ABC ELECTRICALS” in the agrement I have yo be changed where ever it appear  with C2,C3,C4 So On (Cell Vlaues) in Marketing.xls Sheet 2

And Each Time I need to be save with Different Names C2, C3, C4, (Cell Values) So On  

Sub FindAndReplaceFirstStoryOfEachType()



Dim objExcel As Object

Dim rngStory As Range

Dim MyCell As Range

Set objExcel = CreateObject(“Excel.Application”)


Set exWb = objExcel.Workbooks.Open(“D:DesktopMail MergeMarketing.xls”)

‘ThisDocument.m_name.Caption = exWb.Sheets(“Member’s Data”).Cells(3, 3)


Dim i As Integer


For i = 2 To 4


  For Each rngStory In ActiveDocument.StoryRanges

    With rngStory.Find

      .Text = “ABC ELECTRICALS”

      .Replacement.Text = exWb.Sheets(“Sheet2”).Cells(i, 3)

      .Wrap = wdFindContinue

      .Execute Replace:=wdReplaceAll

    End With

  Next rngStory

  ActiveDocument.SaveAs FileName:=exWb.Sheets(“Sheet2”).Cells(i, 3) & “.doc”


  Next i


End Sub

Please Mail Me at bprashant720@gmail.com

By: Prashant

Leave a Reply

Your email address will not be published. Required fields are marked *