dj44
10-10-2017, 09:15 AM
Folks good day,
Well I figured I rather as well try and ask for help and understand what this array is all about.
For each array
I would like to replace term 1 with term2
But I really don't know how to explain this
And I can't even search to explain what this is
But I know this exists
Sub Array_Multiple_Terms()
Dim oRng As Word.Range
Dim oProduct As Variant ' declare some variant
Dim oReplace As Variant
Dim i As Long, j As Long
' Each product has its properties - Loop through each array 1 at a time
oProduct1 = Array("Apple", "Green", "20")
oProduct2 = Array("Banana", "Yellow", "30")
oProduct3 = Array("Cherry", "Red", "50")
'--------------------------
For i = 0 To UBound(oProduct)
Set oRng = ActiveDocument.Range
j = 0
With oRng.Find
Do While .Execute(FindText:=oProduct(i), MatchWholeWord:=True) x wrong
oRng.Text = oProduct(i)(2) x wrong
oRng.Collapse 0
Loop
End With
Next i
Set oRng = Nothing
End Sub
The main code will look for
Apple replace > green
Banana replace > Yellow
and loop through more products arrays
If anyone can shed some light on what this is
that would be awesome and thank you for your help
Well I figured I rather as well try and ask for help and understand what this array is all about.
For each array
I would like to replace term 1 with term2
But I really don't know how to explain this
And I can't even search to explain what this is
But I know this exists
Sub Array_Multiple_Terms()
Dim oRng As Word.Range
Dim oProduct As Variant ' declare some variant
Dim oReplace As Variant
Dim i As Long, j As Long
' Each product has its properties - Loop through each array 1 at a time
oProduct1 = Array("Apple", "Green", "20")
oProduct2 = Array("Banana", "Yellow", "30")
oProduct3 = Array("Cherry", "Red", "50")
'--------------------------
For i = 0 To UBound(oProduct)
Set oRng = ActiveDocument.Range
j = 0
With oRng.Find
Do While .Execute(FindText:=oProduct(i), MatchWholeWord:=True) x wrong
oRng.Text = oProduct(i)(2) x wrong
oRng.Collapse 0
Loop
End With
Next i
Set oRng = Nothing
End Sub
The main code will look for
Apple replace > green
Banana replace > Yellow
and loop through more products arrays
If anyone can shed some light on what this is
that would be awesome and thank you for your help