I really appreciate your help. the last recommendation will serve me well.
here is an example of what needs to be done:
I have to create a write up from a patient encounter. I have to have free
text, such as in the history of present illness. part of that free text is
the same text from prior evaluations, so I created macros to print commonly
repeated segments, such as "There is no evidence of depression, hypomania, or
anxiety on detailed questioning." or "Anxiety has regularly stopped an
activity."
In other areas (such as in recommendations), there is an entire paragraph
that I need to include. In that case, I prepared the paragraph in a separate
template and set up a macro to pull up the template, copy all, close the
template, and paste into my document.
Since these require the use of macros, I complete these sections while the
document is unprotected.
However, there are other sections that would be much easier to use a drop
down menu system, such as in the Review of Systems. I will have drop down
menus for the system to be discussed (HEENT:, Respiratory:, Cardiovascular:,
etc.) next to a text field. Since these require the drop down menus, I need
to protect the document. However, when I type in a text field, I was unable
to use the macros until your recommendation above. However with your
recommendation above, if I use the drop down menu to choose, say,
"Psychiatriatric:" and then type in the text field "Out of control anger "
followed by the "has not been significantly reported recently. " macro, when
the macro is finished, the entire "Out of control anger has not been
significantly reported recently. " is highlighted, so that if I simply
continue to type, I replace the entire field. It would be nice if there was a
system that would allow me to use the macro and end up at the end of the
inserted macro so that I could just continue to type. Remember, the macro may
not be inserted at the end of the text (i.e., If the field was populated with
"Anxiety has been treated with ZZZ without side effects." I may highlight
"ZZZ" and hit a "Celexa" macro, or I may need to strike several sequential
macros, such as "Celexa" followed by a "and psychotherapy" macro. However, if
the entire field is highlighted, or if I embellish on the macro to go to the
end, the subsequent macro insertions are incorrectly placed.
When you advised using the UserForm, I went to the web pages you
recommended, and I used their code recommendations. When I had only one
ComboBox in the template, what you saw was the entire code -- it was not just
part of the code -- if there is something missing, I do not know what is
missing to get the ComboBox to populate.
This is rather lengthy, so you may understand why I was not being coy, I was
just trying to be efficient. Now, you can see exactlyt what I am trying to
do...
I will also post this at the UserForms forum to see what help I may be able
to get...
However, if you do have any recommendations, I would be very appreciative.
Thank you for the time you have spent on this request...
drtomrug
You remain rather coy about *exactly* what you are trying to do which makes
it difficult to provide help.
You appear to have saved the code (of which that you have reproduced is only
part) somewhere other than with the form itself. Double click on a blank
area of the form in the vba editor and paste your code.
The box is populated when you display it in the document.
For userform questions you would do better asking in the Userform or vba
forums
Just a thought - you can use Dropdown form fields in a locked form and add
text to that available using vba. Add an extra list item called "Enter your
own" then run the following macro on exit from the form field (Dropdown1
shown here).
Sub EnterYourOwn()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("Dropdown1").Result
Case Is = "Enter your own"
start:
sText = InputBox("Enter the text for this field")
If sText = "" Then
MsgBox "This field may not be left blank"
GoTo start:
End If
oFld("Dropdown1").Result = sText
Case Else
'Do nothing
End Select
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>