VBA Word 2003 RRS feed

  • Question

  • How to formulate a macro that checks the value that a user selects from a dropdown box, then increments a counter depending on that value.

    Each dropdown box/bookmark can have three values "Met", "Not Met", or "N/A".  The macro will run "On exit" from the dropdown.

    Pseudo code for this might look like -

    Dim Cntr_Met, Cntr-Not, Cntr_NA as integer; (Initialized to 0)

    If DrpDwn.Value = "Met"

       Cntr_Met = Cntr_Met + 1


    DrpDwn.Value = "Not Met"

       Cntr_Not = Cntr_Not + 1


    DrpDwn.Value = "N/A"

        Cntr_NA = Cntr_NA + 1;

    I am not asking you to do the work for me.  If you can point me to sample code or good references where I can learn what I need, it will be of great help.

    Thanks much,


    Sunday, January 4, 2015 4:19 AM


  • Hello,,,,

    I do not know how much it will help in terms of coding part, but as per my knowledge, it is very simple,

    Hence, you have to Set Unique value to each Data Filed in your DropDwonList control, instead of hard-core mentioned, (Initialized to 0),

    Then on Slected_Changed Event you need to Increment that value by 1,

    I hope this will workout for you, if not then please inform for the same.

    Thanks,, :-)

    • Marked as answer by Steve Fan Tuesday, January 27, 2015 1:37 AM
    Friday, January 23, 2015 3:07 PM

All replies