View Single Post
 
Old 05-14-2020, 09:00 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Code:
Private Function Marking() As String
Dim lngIndex As Long
Dim arrMarking() As String
  For lngIndex = 0 To ListBoxMarking.ListCount - 1
    If ListBoxMarking.Selected(lngIndex) Then
      Marking = Marking & ListBoxMarking.List(lngIndex) & "|"
    End If
  Next lngIndex
  If Marking <> vbNullString Then
    arrMarking = Split(Left(Marking, Len(Marking) - 1), "|")
    Marking = vbNullString
    Select Case UBound(arrMarking)
      Case 0: Marking = arrMarking(0)
      Case 1: Marking = arrMarking(0) & " and " & arrMarking(1)
      Case Else
        For lngIndex = 0 To UBound(arrMarking)
          If Not lngIndex = UBound(arrMarking) Then
            Marking = Marking & arrMarking(lngIndex) & ", "
          Else
            Marking = Marking & " and " & arrMarking(lngIndex)
          End If
        Next lngIndex
    End Select
    Marking = "Releasable to " & Marking
  End If
lbl_Exit:
  Exit Function
End Function
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote