Send email from listbox selections

zJenkins

Board Regular
Joined
Jun 5, 2015
Messages
144
Hi,

I have a listbox that is populated based on usernames listed in cells A5-A24. Each username has a checkbox, if the checkbox is selected, I need to send an email with an attachment to that user. I have each of the associated emails listed in column F.

The macro I have first creates and saves a separate Excel file for each employee, then the user will open the userform (listbox) and select to which employees an email will be sent. Upon selecting employees and hitting "Send", an email will be sent to each employee with their respective attached file.

I can't seem to wrap my head around a way to associate each checked box with the email address to send to. This is my basic code so far....

Code:
Private Sub CommandButton1_Click()    
For Each ctrl In Me.Controls
        If TypeName(ctrl) = "CheckBox" Then
            If ctrl.Value = True Then
                
            Else: Next ctrl
        End If
    Next ctrl
End Sub
Any help would be greatly appreciated.

Kind regards
 

Some videos you may like

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Watch MrExcel Video

Forum statistics

Threads
1,099,082
Messages
5,466,535
Members
406,485
Latest member
kaksolver

This Week's Hot Topics

Top