Sending email based on meeting condition in Excel

Joined
Jul 27, 2017
Messages
24
Hi all,

I am fed up with my apartment complex's inability to notify myself and other residents whenever we receive a package to the building. So I am preemptively making a simple excel file for them to use to notify us when a package is received. After creating a tracking sheet for them I thought it would be even better if I could connect the tracker to their email so that all they have to do is note that a person/apartment received a package and then an email would be generated and sent to the corresponding email address saying they received a package. Unfortunately my VBA skills are not what they use to be, and so I am hoping someone here can help.

Can anyone help me with the VBA code I need to write or if there is a command within excel that I can use to connect with email (Outlook for instance)?

Any help I can get on this issue would be great, thanks in advance!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
.
Here is a small project you can start with. Pretty much all there ... just need to arrange the Worksheet layout how you want ?

Code:
Sub Mail_ActiveSheet()
Dim outapp As Object, cl As Range, bodytekst As Variant, outmail As Object, strlocation As String
'strlocation = "C:\Users\ah0118261\Desktop\Goals 2016-FPM Team.pptx"

 With CreateObject("Outlook.Application").createitem(0)
            For Each cl In ThisWorkbook.Sheets("Choose").Columns(2).SpecialCells(2)
                If cl.Value Like "?*@?*.?*" And LCase(cl.Offset(0, 1).Value) = "yes" Then
                    If strto = "" Then strto = stro & ";"
                    strto = strto & cl.Value & ";"
                End If
            Next cl
            'For Each cl In ThisWorkbook.Sheets("Choose").Columns(2).SpecialCells(2)
            '    If cl.Value Like "?*@?*.?*" And LCase(cl.Offset(0, 2).Value) = "yes" Then
            '        If strcc = "" Then strcc = strcc & ";"
            '        strcc = strcc & cl.Value & ";"
            '    End If
            'Next cl
            .To = strto
            .CC = strcc
            .BCC = ""
            .Subject = "Training Structure"
            .Body = "Please write your content"
            '.Attachments.Add (strlocation)
            .display
        End With
End Sub



A
B
C
D
E
F
1
Name​
Email​
Mail?​
2
Name1email1@gmail.comyes
3
Name2email2@yahoo.comno
4
Name3email3@gmail.comno
5
Name4email4@yahoo.comyes


Column C is comprised of DropDowns where the user can selected "YES" or "No" to indicate whether an email should be sent to that address. There is also a CommandButton
on the worksheet, attached to the macro, to send the email.

Download link: https://www.amazon.com/clouddrive/share/hsw8YuF6trPxrSjEEYbwHVumuWpXIm1O1cS1xCkLI1P
 
Upvote 0

Forum statistics

Threads
1,215,379
Messages
6,124,608
Members
449,174
Latest member
ExcelfromGermany

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