Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-14-2020, 08:39 AM
Paskie_be Paskie_be is offline Multiple entries from ListBox Windows 10 Multiple entries from ListBox Office 2016
Novice
Multiple entries from ListBox
 
Join Date: May 2020
Posts: 4
Paskie_be is on a distinguished road
Question Multiple entries from ListBox

Hello,


I have created a word template with User Form. In the latter; I have one field (actually a ListBox) where people can choose several entries. The coding of this box is:
ListBoxMarking.List = Array("", "NATO", "The United Nations", "the African Union", "Troop Contributing States")

The idea is that people can choose any entry, be it one, two or more. These entries would then appear in the created Word document. If no option was chosen, nothing should appear. If any option is chosen, it ought to be preceded by the phrase "Releasable to ".

The coding for that is:
Private Function Marking() As String
Dim x As Integer
Marking = ""
For x = 0 To Me.ListBoxMarking.ListCount - 1
If Me.ListBoxMarking.Selected(x) Then
If Marking = "" Then
Marking = Me.ListBoxMarking.List(x)
Else: Marking = "Releasable to " & Marking & ", " & Me.ListBoxMarking.List(x)


End If
End If
Next x
End Function

The trouble is that the phrase "Releasable to " only appears when there is multiple choices and stays out when only on option is chosen.

Could you please advise to fix this?


Thanks,


Paskie_be
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple entries from ListBox ListBox with multiple columns Kaatje Word VBA 2 02-27-2016 09:37 AM
Link listbox (with multiple columns) to bookmark based on selection dsjk9190 Word VBA 5 01-29-2015 11:28 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
Multiple entries from ListBox 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
Multiple entries from ListBox Delete Multiple Entries dudeabides Office 1 07-04-2011 02:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft