rthomas268
New Member
- Joined
- Jun 7, 2023
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hi,
I will apologize ahead of time because I am definitely new to self-teaching myself how to do this. I need to send 50+ emails to individual recipients with an attachment that is individualized for that person. My spreadsheet is setup with FIRST NAME, LAST NAME, EMAIL, ATTACHMENT columns.
I have been researching this on the internet and YouTube videos so I will paste what I have so far. Everything worked until I put in the .Attachment.Add line - then it stops and I haven't been able to figure out how to fix it. So here it is -
Option Explicit
Sub CreateEmailsforSADonations()
Dim EApp As Object
Set EApp = CreateObject("Outlook.Application")
Dim EItem As Object
Dim path As String
path = "C:\Users\Owner\OneDrive\Documents\GBAI for 2023\2023 Silent Auction\SA DTRecipts\"
Dim RList As Range
Set RList = Range("A2", Range("a2").End(xlDown))
Dim R As Range
For Each R In RList
Set EItem = EApp.CreateItem(0)
With EItem
.To = R.Offset(0, 2)
.Subject = "2023 GBAI Silent Auction Donation Receipt"
.Attachments.Add (path & R.Offset(0, 3))
.Body = "Dear " & R & vbNewLine & vbNewLine _
& "Please find your Donation Receipt attached." _
& vbNewLine & vbNewLine & " Many Thanks" & vbNewLine & vbNewLine & _
"Ralph and Barbara Thomas"
.Display
End With
Next R
End Sub
Tried .Attachments.Add = (path & R.Offset(0, 3)), tried different wording I found online such as Addattachments. , tried inserting the (actual file path & R.Offset(0, 3)).
The Attachments path should refer to the above path and I can see it when I hover over it and the R.Offset also shows when I hover over it. Somewhere there is a bug.
Thanks for any assistance
Please be kind and write in primitive language so I will understand.
Barbara
I will apologize ahead of time because I am definitely new to self-teaching myself how to do this. I need to send 50+ emails to individual recipients with an attachment that is individualized for that person. My spreadsheet is setup with FIRST NAME, LAST NAME, EMAIL, ATTACHMENT columns.
I have been researching this on the internet and YouTube videos so I will paste what I have so far. Everything worked until I put in the .Attachment.Add line - then it stops and I haven't been able to figure out how to fix it. So here it is -
Option Explicit
Sub CreateEmailsforSADonations()
Dim EApp As Object
Set EApp = CreateObject("Outlook.Application")
Dim EItem As Object
Dim path As String
path = "C:\Users\Owner\OneDrive\Documents\GBAI for 2023\2023 Silent Auction\SA DTRecipts\"
Dim RList As Range
Set RList = Range("A2", Range("a2").End(xlDown))
Dim R As Range
For Each R In RList
Set EItem = EApp.CreateItem(0)
With EItem
.To = R.Offset(0, 2)
.Subject = "2023 GBAI Silent Auction Donation Receipt"
.Attachments.Add (path & R.Offset(0, 3))
.Body = "Dear " & R & vbNewLine & vbNewLine _
& "Please find your Donation Receipt attached." _
& vbNewLine & vbNewLine & " Many Thanks" & vbNewLine & vbNewLine & _
"Ralph and Barbara Thomas"
.Display
End With
Next R
End Sub
Tried .Attachments.Add = (path & R.Offset(0, 3)), tried different wording I found online such as Addattachments. , tried inserting the (actual file path & R.Offset(0, 3)).
The Attachments path should refer to the above path and I can see it when I hover over it and the R.Offset also shows when I hover over it. Somewhere there is a bug.
Thanks for any assistance
Please be kind and write in primitive language so I will understand.
Barbara