Send email from listbox selections

zJenkins

Board Regular
Joined
Jun 5, 2015
Messages
148
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
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top