Log in

View Full Version : Return results from combo box AND free text



natcas
09-24-2014, 10:48 PM
hi.
first post, hoping this will be an easy one for someone.
ive tried googling but im that much of a novice vba'er that im obviously using the wrong search terms or terminology.

anyway.

i have a word doc with a bunch of variables like {docvariable Country} and have generated a user form...

my code is (this is for example to make it easy to understand)

if me.checkboxCountry = "True" then
ovars ("Country").value = Me.comboboxcountry
end if

so if someone selects the country box, the value returned to the {docvariable Country} will be what is selected in the countrycombo box.
Im cool with this.


but what if i wanted to make something like this.
if me.checkboxCountry = "True" then
ovars ("Country").value = Me.comboboxcountry "PEANUT"
end if


such tha the value returned to the {docvariable Country} will be what is selected in the countrycombo box and the word PEANUT tacked on after it.


just wondering if there is any simple way of doing this while maintaining my current code (or minor mods) :)

thanks for anyones time and please refrain from punching your monitor if this is a stupid question..


New Guy.

macropod
09-25-2014, 02:07 AM
Simple:
ovars ("Country").value = Me.comboboxcountry & "PEANUT"

natcas
09-25-2014, 01:49 PM
Thanks Paul.
Works great