VBA Coding Help RRS feed

  • Question

  • Hello All,

    I need some help coding for document.  My document is going to be used for a hospital blood bank. It is called an antigram worksheet.  It consists of 11 donor red blood cells that are positive for different red blood cell antigens. Each antigen is positive on certain donor red blood cells. For example, a patient could be positive in donor cell 1, 2, 3, 4, and 11, and the interpretation would be anti-D from a drop-down list content control.  So, I want to know if there is a way to code the document so that it will automatically interpret the results from a drop-down list content control once an user records their results.


    Monday, June 24, 2019 6:52 PM

All replies

  • Undoubtedly you can.

    Presumably you would want to change the values of some from a selection of eleven check boxes and produce the value related to that that selection from a dropdown list containing all the possible combinations?

    The main coding difficulty, using such a selection from eleven check boxes in a document and automatically providing the correct value from the drop down selection would be in determining when all the selections are made. For it to be automatic then the value would change each time you make a selection. This I fear is open to all kinds of error and I would therefore caution against it.

    It would be better to create a userform that contains the check boxes with a button to indicate that the selections have been made. Then depending on the selection, the appropriate value could be written to the document, not into a drop down list, but into a text content control. The values are thus stored in the code (or in a worksheet or whatever), depending on how many there are of them (Bearing in mind I know nothing about your processes).

    As you refer to a 'worksheet' it may be that you have the values recorded for the eleven values and you don't anticipate manually entering them. The principal remains the same, i.e. one of evaluating the input and producing the required result.

    Unfortunately your message does not provide enough information to go into any depth.

    Graham Mayor - Word MVP

    Tuesday, June 25, 2019 11:44 AM
  • I had to do something similar.  I had numerous options to create a  memory configuration for an integrated circuit.  I created a database with all valid configurations.  As the user selects options it limits options in other selections.  It was a challenging program.  The database contained 1000's of rows.  However searching was very fast and the program was very responsive.
    Tuesday, June 25, 2019 12:34 PM