lawsonbooth
11-15-2015, 02:41 PM
My oprevious post "Listbox Problem with multi-select" was marked as siolved not by me and there were no replirs. So I will try again.
Please accept my thanks for any help in advance.
I have a multi-select listbox of hyperlinks and trying to insert selected into Outlook mail iteem from Access. The body is not HTML. I have to use plain text.
Could someone look at the following code and tell me why only the first selected item column(2) prints for all items selected in list. If I select items 2, 5, 7 and run the code item 2 column(2) prints 3 times, I do not get 5 & 7.
VBA
''add links to body
If Me.lstLinks.ListCount <> 0 Then
For n = 0 To (Me.lstLinks.ListCount - 1)
If Me.lstLinks.Selected(n) = True Then
xStrLink = Me.lstLinks.Column(2)
xBody = xBody & vbCrLf & vbCrLf & xStrLink
End If
Next n
End If
Please accept my thanks for any help in advance.
I have a multi-select listbox of hyperlinks and trying to insert selected into Outlook mail iteem from Access. The body is not HTML. I have to use plain text.
Could someone look at the following code and tell me why only the first selected item column(2) prints for all items selected in list. If I select items 2, 5, 7 and run the code item 2 column(2) prints 3 times, I do not get 5 & 7.
VBA
''add links to body
If Me.lstLinks.ListCount <> 0 Then
For n = 0 To (Me.lstLinks.ListCount - 1)
If Me.lstLinks.Selected(n) = True Then
xStrLink = Me.lstLinks.Column(2)
xBody = xBody & vbCrLf & vbCrLf & xStrLink
End If
Next n
End If