Send an email with vba

Jerrbear

New Member
Joined
Jan 16, 2018
Messages
5
I need a thread to send an email out with in 30 days of a date to remind of a due date using macros. Need help please. I have the email set up just need the 30 days
I need to send an email when the date in the column reaches 30 days. I need help please.

This is what I have and it works, I just need to add 30 day string. Is this possible???

private Sub CommandButton7_Click()

Dim outApp As Object
Dim outMail As Object
Dim Strbody As String

Set outApp = CreateObject("outlook.Application")
Set outMail = outApp.CreateItem(0)

Strbody = "Email."
On Error Resume Next
With outMail
.to = "@@@@"
.Subject = "Email "
.Body = Strbody
.send

End With
On Error GoTo 0
Set outMail = Nothing
Set outApp = Nothing
End Sub


I have tried this but it does not work.
Stay in the outbox untill this date and time

.DeferredDeliveryTime = "1/6/2007 10:40:00 AM"

'Wait four hours
.DeferredDeliveryTime = DateAdd("h", 4, Now)

'in 30 days
.DeferredDeliveryTime = DateAdd("d", 30, Now)
Last edited by ranman256; J
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Well i'd be inclined to have the macro create a page with just the ones you want to email on it (filter to 30 days plus, copy and paste to new sheet and email from the addresses on that list)
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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