newguy
Well-known member
I am trying to fill diff content controls with text from my form, here is my code, and the first content control fills but the second one does not, any ideas?
Have also tried this... to no avail.
VB.NET:
Dim objcc As Microsoft.Office.Interop.Word.ContentControl
For Each objcc In oDoc.ContentControls
If objcc.Title = "Units" Then
objcc.Range.Text = "Units Assigned to incident : " & TextBox2.Text
End If
If objcc.Title = "Narrative" Then
objcc.Range.Text = TextBox1.Text
End If
Exit For
Next
Have also tried this... to no avail.
VB.NET:
For Each objcc In oDoc.ContentControls
If objcc.Tag = "Units" Then
objcc.Range.Text = "Units Assigned to incident : " & TextBox2.Text
End If
Exit For
Next
Dim objcc2 As Microsoft.Office.Interop.Word.ContentControl
For Each objcc2 In oDoc.ContentControls
If objcc2.Tag = "Narrative" Then
objcc2.Range.Text = TextBox1.Text
End If
Exit For
Next
Last edited: