OK, this one is doing my head in!
I'm using aleb's most handy code from this thread to have a multi select list box that determines recipients of an e-mail from the list.
I thought it would be handy to have it make a list that updates at the same time, showing what e-mail addresses will be sent. Here's the code I used:
The code works, but when the text box becomes filled, you cannot see the bottom of the list.
Many thanks in advance for any assistance!
I'm using aleb's most handy code from this thread to have a multi select list box that determines recipients of an e-mail from the list.
I thought it would be handy to have it make a list that updates at the same time, showing what e-mail addresses will be sent. Here's the code I used:
Code:
Private Sub lstMailTo_Click()
Dim varItem As Variant
Dim strList As String
[COLOR="red"]Dim strElist As String[/COLOR]
Me.cmdEmail.Enabled = True
With Me!lstMailTo
If .MultiSelect = 0 Then
Me!txtSelected = .Value
Else
For Each varItem In .ItemsSelected
strList = strList & .Column(0, varItem) & ";"
[COLOR="Red"]strElist = strElist & .Column(0, varItem) & vbNewLine[/COLOR] Next varItem
If strList = "" Then
Me!txtSelected = strList
Me.cmdEmail.Enabled = False
[COLOR="red"]Me!txtEadd = ""[/COLOR]
Else
strList = Left$(strList, Len(strList) - 1)
Me!txtSelected = strList
[COLOR="red"]Me!txtEadd = strElist[/COLOR]
End If
End If
End With
End Sub
The code works, but when the text box becomes filled, you cannot see the bottom of the list.
- How can I set it to know this and automatically put a scroll bar in, so the addresses can be reviewed before hitting send?
- I was interested to see if I could do something similar, but instead have a label display just the last item selected. I tried strElist = .Column(0, varItem) and setting the label caption to strElist, but this only displayed the first item selected. How would I do this?
Many thanks in advance for any assistance!