Share via

Excell to word

SteveD 125 Reputation points
2026-02-23T20:48:56.1433333+00:00

Hell from Steve

The below is an excel version, Can I please have a "word" version

Sub Test()
Dim Words, I As Long
Words = [{"Omalley", "Thurlow O'malley", "T Ebbett", "P & T Ebbett", "B Kelso", "K & B Kelso", "R Foote", "B & R Foote"}]
For I = 1 To UBound(Words) Step 2
    Cells.Replace Words(I), Words(I + 1), xlWhole
Next I
End Sub
Microsoft 365 and Office | Word | For home | Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2026-02-23T20:49:04.7666667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To convert the provided Excel VBA code to Word VBA, you would need to adjust the syntax and object references accordingly. Below is a Word version of your code that performs a similar function, replacing specific words in the active document:

    Sub Test()
        Dim Words As Variant, I As Long
        Words = Array("Omalley", "Thurlow O'malley", "T Ebbett", "P & T Ebbett", "B Kelso", "K & B Kelso", "R Foote", "B & R Foote")
        For I = LBound(Words) To UBound(Words) Step 2
            With ActiveDocument.Content.Find
                .Text = Words(I)
                .Replacement.Text = Words(I + 1)
                .Wrap = wdFindContinue
                .Execute Replace:=wdReplaceAll
            End With
        Next I
    End Sub
    

    This code uses the Find and Replacement objects to search for each word in the Words array and replace it with the corresponding word. Make sure to run this macro in a Word document where you want the replacements to occur.

    1 person found this answer helpful.
    0 comments No comments

  2. SteveD 125 Reputation points
    2026-02-23T21:01:03.9333333+00:00

    Hello AI I thank you

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.