Need more help...

Mindy2017

New Member
Joined
Aug 7, 2018
Messages
7
I recently created a spreadsheet that will notify me of upcoming offsite meetings by two weeks.

Here is a partial code

With OutLookMailItem
.to = MailDest1
.bcc = MailDest2
.Subject = Range("a1").Value
.Body = Range("B1").Value

I like the subject line to include the following: A Gentle Reminder: Boston (which ever location is within that 2 week notice.)

a b
1A Gentle Reminder:<strike></strike>
<strike></strike>
2Boston8/15/2018
3New York8/20/2018

<tbody>
</tbody>


<colgroup><col></colgroup><tbody>
</tbody>
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Something like this? For A Gentle Reminder: Boston, New York

Code:
Sub example()


Dim rownum As Long
Dim mystr As String


rownum = 2
Do Until Cells(rownum, 2).Value = ""
If Cells(rownum, 2).Value <= Date + 14 Then
mystr = mystr + Cells(rownum, 1).Value & ", "
End If
rownum = rownum + 1
Loop


mystr = Left(mystr, Len(mystr) - 2)


With OutLookMailItem
.to = MailDest1
.bcc = MailDest2
.Subject = Range("a1").Value & " " & mystr
.Body = Range("B1").Value




End Sub
 
Upvote 0
First and foremost, thank you for this code. It is in the right direction but unfortunately it is pulling everyone name on the list. What I was hoping for is that It would only pull anything that had "Send Reminder" in column (let say C).


Basically the subject line should read "This is a friendly reminder (anything that has Send reminder in the column).

I was trying to past a picture but it would not let me.

So my current code:
With OutLookMailItem
.to = MailDest1
.bcc = MailDest2
.Subject = Range("a1").Value (only pulls "Friendly Reminder") I would like it to also pull anything that come up "Send Remember".
.Body = Range("B1").Value
'.send


ABCD
1Friendly Reminder
3LocationDateDaysreminder
4New York8/30/1820
5Boston8/17/1810Send Reminder

<tbody>
</tbody>






Something like this? For A Gentle Reminder: Boston, New York

Code:
Sub example()


Dim rownum As Long
Dim mystr As String


rownum = 2
Do Until Cells(rownum, 2).Value = ""
If Cells(rownum, 2).Value <= Date + 14 Then
mystr = mystr + Cells(rownum, 1).Value & ", "
End If
rownum = rownum + 1
Loop


mystr = Left(mystr, Len(mystr) - 2)


With OutLookMailItem
.to = MailDest1
.bcc = MailDest2
.Subject = Range("a1").Value & " " & mystr
.Body = Range("B1").Value




End Sub
 
Upvote 0
You're welcome!

So you want to send a list of the cities that are within 2 weeks AND have "send reminder" in column C?

Code:
Sub example()

Dim rownum As Long
Dim mystr As String

rownum = 2
Do Until Cells(rownum, 2).Value = ""
If Cells(rownum, 2).Value <= Date + 14 and Cells(rownum, 3).Value = "Send Reminder" Then                 ''change made here
mystr = mystr + Cells(rownum, 1).Value & ", "
End If
rownum = rownum + 1
Loop

mystr = Left(mystr, Len(mystr) - 2)

With OutLookMailItem
.to = MailDest1
.bcc = MailDest2
.Subject = Range("a1").Value & " " & mystr
.Body = Range("B1").Value

End Sub
 
Last edited:
Upvote 0
We are getting there...I can't say thank you enough. I do have what I hope is the last question...

the attached picture is showing that the line "mystr=left(mystr, Len(mystr)-2) is an invalid procedure or argument.

https://greyco.box.com/s/7s9bszb82054yd4fa3xr912gl7s7249t
7s9bszb82054yd4fa3xr912gl7s7249t
 
Upvote 0
Not sure why that would be. It's only function is to remove the ", " though. If this is just for you maybe just ignore it.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

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