View Single Post
 
Old 08-31-2022, 05:49 AM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For example:
Code:
Sub DemoB()
Application.ScreenUpdating = False
Dim StrVAR1 As String, StrVAR2 As String, i As Long, j As Long
StrVAR1 = "red|white|blue"
StrVAR2 = "dot|star|check"
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Forward = True
  .Wrap = wdFindContinue
  .MatchWildcards = True
  For i = 0 To UBound(Split(StrVAR1, "|"))
    For j = 0 To UBound(Split(StrVAR2, "|"))
      .Text = "<VAR1>"
      .Replacement.Text = Split(StrVAR1, "|")(i)
      .Execute Replace:=wdReplaceOne
      .Text = "<VAR2>"
      .Replacement.Text = Split(StrVAR2, "|")(j)
      .Execute Replace:=wdReplaceOne
   Next
  Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote