Hello,
I'M trying to replace the contents conntrol of a word document but my code isn't working.
Situation: I need to replace content controls of word document with the contents of column B considering Navette sheet but this should only happen if the column A has the same name as the titles of content controls.
Example:
Content control of document title = Name
Column A cell A1 name = Name
Replacement of content control should be content of cell B1
It should occur in loop
I made a code but isn't working:
I'M trying to replace the contents conntrol of a word document but my code isn't working.
Situation: I need to replace content controls of word document with the contents of column B considering Navette sheet but this should only happen if the column A has the same name as the titles of content controls.
Example:
Content control of document title = Name
Column A cell A1 name = Name
Replacement of content control should be content of cell B1
It should occur in loop
I made a code but isn't working:
VBA Code:
[
Dim row As Long
For row = 1 To Navette.UsedRange.Rows.Count
If Navette.Range("A" & row).Value = wordDoc.ContentControls(Navette.Range("A" & row).Value).Range.Text Then
wordDoc.ContentControls(Navette.Range("A" & row).Value).Range.Text = Navette.Range("B" & row).Value
End If
Next row
]