![]() |
|
#10
|
||||
|
||||
|
Unfortunately you can't adapt the code as you have done, with regard to the list box. If you want to insert multiple values from the list box then you must add each selected value to the bookmark. There are a number of ways of doing this, but the simplest is to add them to a text string and then add the text string to the bookmark e.g. as follows.
Don't forget to declare the string strText in the DIM statements at the top of the macro! I assume that you removed any reference to the text box from the userform code.Debug > Compile Project should reveal any glaring coding errors. Have a good Christmas. Code:
.Show
If .Tag = 1 Then 'OK button pressed
With .ListBox1
'locate the selected items from the list box and add to a string
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
If strText = "" Then
strText = strText & .List(i)
Else
strText = strText & vbCr & .List(i)
End If
End If
Next i
End With
FillBM "BM1", strText
End If
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Yet another Multi-Select Listbox in Userform question
|
Javir | Word VBA | 4 | 09-24-2019 01:01 AM |
| Dynamic Userform multiselect listbox populate | trevorc | Excel Programming | 1 | 12-03-2018 02:49 PM |
| How do I code ListBox and DatePicker in UserForm? - Word 2013 | ickelly | Word VBA | 4 | 08-05-2015 04:07 PM |
| This is a Userform LIstbox queston: A variable does not set to the value of a listbox | CatMan | Excel Programming | 14 | 08-18-2014 08:14 PM |
This is a Userform LIstbox queston: A variable does not set to the value of a listbox
|
CatMan | Excel | 1 | 08-08-2014 09:41 AM |