I guess you would want to make sure that TXT_value = one of your session values. You can check that using an On Error with a line that would cause an error. You would have to iterate all of the i's in your first block of code and then compare each to your Txt_Value.
I guess the rest of the email part works except for the ListBox?
Here is one way to get the selected items. The Join() part is what you will concatenate in your Body string.
Private Sub CommandButton2_Click() 'OK button Dim a a = LbCb1ToArray(REASON_Listbox) If Not IsArray(a) Then Exit Sub MsgBox Join(a, vbCrLf) End Sub 'Listbox column 1 or combobox column 1 to array. Private Function LbCb1ToArray(LbCb As Control) Dim i As Long, j As Long, a With LbCb ReDim a(1 To .ListCount) For i = 0 To .ListCount - 1 If .Selected(i) = True Then j = j + 1 a(j) = .List(i, 0) End If Next i End With If j > 0 Then ReDim Preserve a(1 To j) LbCb1ToArray = a End If End Function




Reply With Quote
