I am trying to create a word template in which a user will be able to select items from a list box. The selected items from the list box will then be sent to another list box via a command button. However I am having problems saving the items in the second list box. When ever i reopen the document, the second list box no longer contains the selected items. Is there anyone out there who could help me out with this problem? I think I need to use the Document_save event, however I am very new to vba and am not sure how to accompish this task. I've attached the code that I have. Thanks in advance.
Private Sub Document_New() PopulateListBoxes
'Clears out second list for a new document lstbox2.Clear End Sub
Private Sub Document_Open() PopulateListBoxes End Sub
Private Sub cmdMovetoRight_Click()
Dim i As Integer
If lstbbox1.ListIndex = -1 Then Exit Sub For i = lstbox1.ListCount - 1 To 0 Step -1 If lstbox1.Selected(i) = True Then lstbox2.AddItem lstbox1.List(i) lstbox1.RemoveItem i End If Next i End Sub Private Sub cmdMovetoLeft_Click()
Dim i As Integer
If lstbox.ListIndex = -1 Then Exit Sub For i = lstbox2.ListCount - 1 To 0 Step -1 If lstbox2.Selected(i) = True Then lstbox1.AddItem lstbox2.List(i) lstbbox2.RemoveItem i End If Next i End Sub