I need help getting started on the code for adding the word 'and' to a message box after the user has selected items from a list box to make the message box grammatically correct. Possibly removing the last comma too.
Private Sub cmdSelect_Click()
Dim IntIndex As Integer, strSelectedHHItems As String
For IntIndex = 0 To lstHouseHoldItems.ListCount
If lstHouseHoldItems.Selected(IntIndex) Then
strSelectedHHItems = strSelectedHHItems & "," & " " & lstHouseHoldItems.Column(0, IntIndex)
End If
Next
strSelectedHHItems = Right(strSelectedHHItems, Len(strSelectedHHItems) - 1)'remove beginning space
MsgBox "You have selected" & (strSelectedHHItems)
End Sub
I am an amateur, I know it will require the use of some intrinsic functions like Mid or Len but I can't think of how to do it. Your assistance is greatly appreciated.