![]() |
#1
|
|||
|
|||
![]()
Hi,
I've been through most of the posts related to Multi-Select Listbox in a Userform. I have a simple letter that triggers a Userform asking for a surname and a Multi-Select Listbox (called services). In the word doc I assigned Doc Variable var1 for the name and Doc Variable var2 to include the options chosen in the Listbox. The problem is I can't seem to make it work. My Ok button code is: Private Sub cmdOK_Click() Set oVars = ActiveDocument.Variables Hide oVars("var1").Value = surname.Value ActiveDocument.Fields.Update Set oVars = Nothing Dim i As Long Dim StrOut As String For i = 0 To Me.services.ListCount - 1 If Me.services.Selected(i) Then StrOut = StrOut & Me.services.List(i) & vbCr End If Next i oVars("var3") = StrOut Unload Me End Sub If I change oVars("var3") to MsgBox, the code works. But it doesn't insert the options in the document, of course, as it's a MsgBox. Any help? Thanks! Javier |
Tags |
listbox bookmark, variables, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Userform multiselect listbox populate | trevorc | Excel Programming | 1 | 12-03-2018 02:49 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 |
![]() |
CatMan | Excel | 1 | 08-08-2014 09:41 AM |
How to use an ActiveX Control to insert a multi select listbox in Word | marksm33 | Word | 2 | 01-29-2014 05:21 PM |
![]() |
gvibe@hotmail.com | Word VBA | 1 | 07-19-2013 10:54 AM |