Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Automation - filling content controls.

Status
Not open for further replies.

VB4Life

Programmer
Nov 8, 2008
50
US
Hi all,
I have a Word 2007 template with several content controls(plaintext), and throught word automation I can transfer text to the first one, but not the second one? I have reviewed each content control's property they are both editable - not write protected, my code:

Dim objcc as Microsoft.Office.Interop.Word.ContentControl
for each objcc in oDoc.ContentControls
If objcc.tag = "Title" then
objcc.range.text = textbox1.text
end if
If objcc.tag = "Story" then
objcc.range.text = textbox2.text
end if
exit for
next

Thanks for looking...
 
So the answer is - I deleted the line 'Exit For' and it is working fine. [2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top