J
John Guderian
Ive got a userform, that displays a list of departments. I would like
someone to be able to make multiple selections, and place thos selections
into a single bookmark separated by commas. This bookmark is contained
within the header.
The current code I have to populate the listbox, and place the last selected
item into the bookmark is below.
Thanks for your help!
Private Sub UserForm_Initialize()
lstDepartments.List = Array("Accts. Payable", "Accts. Receivable",
"Service", "Rentals", "Warehouse")
End Sub
Private Sub CommandButton1_Click()
With lstDepartments
For x = 0 To .ListCount - 1
If .Selected(x) Then
UpdateBookmark "Text2", lstDepartments.List(x)
End If
Next
End With
Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub
someone to be able to make multiple selections, and place thos selections
into a single bookmark separated by commas. This bookmark is contained
within the header.
The current code I have to populate the listbox, and place the last selected
item into the bookmark is below.
Thanks for your help!
Private Sub UserForm_Initialize()
lstDepartments.List = Array("Accts. Payable", "Accts. Receivable",
"Service", "Rentals", "Warehouse")
End Sub
Private Sub CommandButton1_Click()
With lstDepartments
For x = 0 To .ListCount - 1
If .Selected(x) Then
UpdateBookmark "Text2", lstDepartments.List(x)
End If
Next
End With
Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub