PDA

View Full Version : Change Content Control Check Box to Checked when TextBox is populated.



Rottimom
03-15-2016, 12:44 PM
I have legacy Word Template with Check Box Content Control that needs to be changed to checked when a TextBox is populated on CmdOK_Click().

gmaxey
03-15-2016, 12:52 PM
What kind of textbox? What is the relationship of the textbox with CmdOK_Click? Are you using a userform?

Something Liked If .Textbox1.Text <>vbNullString then ActiveDocument.SelectConentControl.ByTitle("The CC Title).Item(1).Checked.Value = True

You may have just saved yourself $40.

Rottimom
03-16-2016, 08:54 AM
Your code did not work for me but with a little tweaking I got this to work.

If Me.Textbox1.Text <> vbNullString Then ActiveDocument.SelectContentControlsByTitle("CC Title").Item(1).Checked = True

I don't do these modifications enough to keep this all fresh in my mind. Having great resources like you out there is a godsend.

Thanks!

gmaxey
03-16-2016, 09:03 AM
Ok. That was off the cuff pecked out on my cell. Glad you got it to work.