PDA

View Full Version : Display ComboBox result in multiple row DocVariable



DavG63
12-03-2015, 02:06 AM
Hi

I'm hoping someone can point me in the right direction towards resolving this issue.

At the moment, I have a combobox on a userform which populates a DocVariable on my word document - it's for an address, for example, "29 Acacia Road, Nuttytown".

The result I get at the moment is "29 Acacia Road, Nuttytown", i.e. exactly as input.

What I'd like the result to be displayed as however is:-

"29 Acacia Road
Nuttotown"

using the comma as a separator.

Any ideas how to do so?

Thanks

Dav

gmayor
12-03-2015, 02:15 AM
ActiveDocument.Variables("varAddress").Value = Replace(ComboBox1.Text, ", ", vbCr)

DavG63
12-03-2015, 02:47 AM
Thanks so much Graham, I will give this a bash.

DavG63
12-03-2015, 09:00 AM
Took me a little playing around to get it in the right place in the sequence but it does exactly what I was hoping for. Thanks again Graham.