![]() |
|
#1
|
|||
|
|||
![]() I have a form a user enters in data and click ok event puts on word document. My question is how can I give that data a numerical value? Thanks |
#2
|
||||
|
||||
![]()
With your initialisation, you could add the values, so:
Code:
Private Sub UserForm_Initialize() cmbCat.AddItem "HHP" 'ListIndex = 0 cmbCat.Column(1, 0) = 1234 cmbCat.AddItem "Demographics" 'ListIndex = 1 cmbCat.Column(1, 1) = 2345 cmbCat.AddItem "Immunization" 'ListIndex = 2 cmbCat.Column(1, 2) = 3456 cmbCat.AddItem "History and Physical" 'ListIndex = 3 cmbCat.Column(1, 3) = 4567 cmbCat.AddItem "Progress Note" 'ListIndex = 4 cmbCat.Column(1, 4) = 5678 cmbCat.AddItem "Labs" 'ListIndex = 5 cmbCat.Column(1, 5) = 6789 cmbCat.AddItem "Xray" 'ListIndex = 6 cmbCat.Column(1, 6) = 7890 cmbCat.AddItem "EKG" 'ListIndex = 7 cmbCat.Column(1, 7) = 8901 cmbCat.AddItem "Physician Orders" 'ListIndex = 8 cmbCat.Column(1, 8) = 9012 cmbCat.AddItem "Consults" 'ListIndex = 9 cmbCat.Column(1, 9) = 2468 cmbCat.AddItem "Misc" 'ListIndex = 10 cmbCat.Column(1, 10) = 4810 cmbCat.AddItem "RX" 'ListIndex = 11 cmbCat.Column(1, 11) = 1012 cmbCat.AddItem "Encounters" 'ListIndex = 12 cmbCat.Column(1, 12) = 1248 cmbCat.AddItem "HHP" 'ListIndex = 13 cmbCat.Column(1, 13) = 1357 'Using drop down list cmbCat.Style = fmStyleDropDownList ' ComboBox valuers are List Index Values cmbCat.BoundColumn = 0 ' setting cmbCat to first entry cmbCat.ListIndex = 0 End Sub vCat = UserForm1.cmbCat.Column(1) Do note that, in many barcoding systems (eg code 128), you can't simply take an alpha/numeric string and apply the barcode font to it - you must first transform the entire string via a compression code and it's the compressed code that gets barcoded. Accordingly, outputting each variable into separate formfields won't work for such systems. It may be OK for Code 3of9, though, but even that requires asterisks at each end.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Tags |
combo box, dropdown, forms, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
add values to dropdown selections and calculate | guyhs | Word | 7 | 10-24-2012 05:11 PM |
![]() |
biffle0764 | Word | 2 | 05-09-2012 12:54 PM |
Macro to populate a text form field based on dropdown selection | koloa | Word | 0 | 10-20-2011 11:52 AM |
Automatic find replace after selection in dropdown | vsempoux | Word | 0 | 10-28-2009 08:45 AM |
Validating Dropdown box | dammad83 | Word VBA | 0 | 03-01-2006 12:40 PM |