checkboxes to text in MS word
Helloo VB gurus,
I work in a doctors office and am hoping for someone can lend some help. I have created a simple template form in MS word with many checkboxes and several textboxes. My goal is to link the checkboxes to another word document, such that the new document will return specific text values for each checkbox depending on whether their value is "true" or "false." I am also looking to return the actual text box values in the word form to the new document. I have experience using mail merge with excel/word, but unfortunately am new to VB. Is there a way to go about this without using excel or other database program? Thanks so much for your help
Re: checkboxes to text in MS word
you can read the checked value of each checkbox, but
are you using forms checkboxes or controls checkboxes as the code would be different for each, which menu do you use to add the checkboxes?
Re: checkboxes to text in MS word
thanks for the quick reply, i... think the answer to your question is that i'm using "active-x control" checkboxes... does that make sense? thanks again
Re: checkboxes to text in MS word
to add checkboxes, i use MS word 2007>developer tab>controls>legacy tools>activeX control checkbox
Re: checkboxes to text in MS word
as i don't have 2007 i just guess these are same as controls checkboxes /textboxes
if so you can address them as members of the inlineshapes collection, that way you can loop through them
Re: checkboxes to text in MS word
ok, so could you tell me how to address them as members of the inlineshapes collection and loop through them, or where else to look to get that information? Thanks for your patience, I don't have much programming experience
Re: checkboxes to text in MS word
i guess if you have bookmarks in the destination document with the same names as the text or checkboxes
for textboxes something like
vb Code:
for each ctrl in documents("sourcedoc").inlineshapes
with ctrl.oleformat.object
select case typename(ctrl.oleformat.object)
case "TextBox": activedocument.bookmarks(.name).range.text = .value
case "CheckBox"
if .value then
activedocument.bookmarks(.name).range.text = somevalue ' based on checkbox name and checked
else
activedocument.bookmarks(.name).range.text = someothervalue ' based on checkbox name and unchecked
end if
end select
end with
next