A
Ailish
Hi Everyone,
My quest is for a code snippet that would grab what has been selected in one
combo box content control (Word 2007), transfer it to an identical combo box
content control in another section of my document and return the first
content control to placeholder text.
For example: transfer data from a combo box content control with the unique
title cmbx1MobAid to cmbx3MobAid
To complicate matters, because this is a combo box, the users of the
document may have (for example):
(a) selected "Zimmer frame" from the dropdown list
(b) adapted the dropdown selection of "Zimmer frame" as above by adding
their own text "Uses" before and "at night only" after. So the print-out
reads: "Uses Zimmer frame at night only" (This was relevant to a recent
patient who could walk independantly by day but was far less capable at night
and illustrates a nurse's need to be able to manipulate the information
provided in a content control to fit the individual.)
(c) not selected anything from the dropdown list and typed in the name of a
new mobility aid that was never on the dropdown list at all.
Here's a code snippet that works for transferring plain text controls from
room 1 to room 3 - I thought it might give you an idea of what I'm trying to
do with combo boxes, dropdown lists and date pickers:
Dim str1PtName as String
'declares string variable = whatever has been selected in content control
with title 1PtName
str1PtName =
ActiveDocument.SelectContentControlsByTitle("1PtName").Item(1).Range.Text
'transfers patient's name from room 1 to room 3
ActiveDocument.SelectContentControlsByTitle("3PtName").Item(1).Range.Text =
str1PtName
'removes name from room 1
ActiveDocument.SelectContentControlsByTitle("1PtName").Item(1).Range.Text = ""
Actually the above has only been a partial success in that it replaces the
placeholder text which is in a pale grey font that is not intrusive on the
print-out to a black font which would be intrusive - I don't like that.
The background to this is that I'm a nurse (no IT qualifications so please
bear that in mind where jargon is concerned), working for a hospice charity
in the UK, with an interest in making all those expensive computers we have
sitting in our offices actually work for us! What I'm working on is a form
which provides up-to-date info about our in-patients to nurses coming on duty.
My document is laid out according to room location on each ward but
sometimes patients get transferred from say a shared room to a single room
when there is a great need for privacy or vice versa if they feel a bit
lonely and would like a bit of company. What's good for the patient and
family can totally muck up the layout of my form and give my colleagues a lot
more typing to do - not popular, I can tell you! Up till now I've told my
colleagues that automating the transfer is in the "too hard" basket but
thanks to help from this (thanks Jay!) and other forums, I've achieved other
things that I thought were impossible. It would be very cool to achieve this
one too.
Thanks for reading this far and thanks for any help you can offer.
Ailish
My quest is for a code snippet that would grab what has been selected in one
combo box content control (Word 2007), transfer it to an identical combo box
content control in another section of my document and return the first
content control to placeholder text.
For example: transfer data from a combo box content control with the unique
title cmbx1MobAid to cmbx3MobAid
To complicate matters, because this is a combo box, the users of the
document may have (for example):
(a) selected "Zimmer frame" from the dropdown list
(b) adapted the dropdown selection of "Zimmer frame" as above by adding
their own text "Uses" before and "at night only" after. So the print-out
reads: "Uses Zimmer frame at night only" (This was relevant to a recent
patient who could walk independantly by day but was far less capable at night
and illustrates a nurse's need to be able to manipulate the information
provided in a content control to fit the individual.)
(c) not selected anything from the dropdown list and typed in the name of a
new mobility aid that was never on the dropdown list at all.
Here's a code snippet that works for transferring plain text controls from
room 1 to room 3 - I thought it might give you an idea of what I'm trying to
do with combo boxes, dropdown lists and date pickers:
Dim str1PtName as String
'declares string variable = whatever has been selected in content control
with title 1PtName
str1PtName =
ActiveDocument.SelectContentControlsByTitle("1PtName").Item(1).Range.Text
'transfers patient's name from room 1 to room 3
ActiveDocument.SelectContentControlsByTitle("3PtName").Item(1).Range.Text =
str1PtName
'removes name from room 1
ActiveDocument.SelectContentControlsByTitle("1PtName").Item(1).Range.Text = ""
Actually the above has only been a partial success in that it replaces the
placeholder text which is in a pale grey font that is not intrusive on the
print-out to a black font which would be intrusive - I don't like that.
The background to this is that I'm a nurse (no IT qualifications so please
bear that in mind where jargon is concerned), working for a hospice charity
in the UK, with an interest in making all those expensive computers we have
sitting in our offices actually work for us! What I'm working on is a form
which provides up-to-date info about our in-patients to nurses coming on duty.
My document is laid out according to room location on each ward but
sometimes patients get transferred from say a shared room to a single room
when there is a great need for privacy or vice versa if they feel a bit
lonely and would like a bit of company. What's good for the patient and
family can totally muck up the layout of my form and give my colleagues a lot
more typing to do - not popular, I can tell you! Up till now I've told my
colleagues that automating the transfer is in the "too hard" basket but
thanks to help from this (thanks Jay!) and other forums, I've achieved other
things that I thought were impossible. It would be very cool to achieve this
one too.
Thanks for reading this far and thanks for any help you can offer.
Ailish