|
-
Mar 15th, 2010, 03:01 PM
#1
Thread Starter
New Member
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
-
Mar 15th, 2010, 03:36 PM
#2
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?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 15th, 2010, 04:17 PM
#3
Thread Starter
New Member
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
-
Mar 15th, 2010, 06:17 PM
#4
Thread Starter
New Member
Re: checkboxes to text in MS word
to add checkboxes, i use MS word 2007>developer tab>controls>legacy tools>activeX control checkbox
-
Mar 16th, 2010, 03:27 AM
#5
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 16th, 2010, 04:05 PM
#6
Thread Starter
New Member
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
-
Mar 17th, 2010, 02:27 AM
#7
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|