J
J.Alladien
Good day everyone,
I Need a code to send e-mail one by one to e-mail adresses from my Customers
table/Query with the same attachmnt - in my case one single PDF file, I need
it to be done this way as some of the recepients have spam filters and my
e-mail to them gets filtered out!
As I am not real good in code I have tried for hours but with no succes!
This code from Arvin myer is actually what I am lookin for only I need it in
a LOOP function and I need the e-mail adress not to be fixed ,but to be
adress which is in my E-MAIL field from my table, see below
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "(e-mail address removed)"
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
Or I also have this function:
Function FaxInvoices()
Dim dbsNorthwind As Database
Dim rstCustomers As Recordset
Set dbsNorthwind = CurrentDb()
Set _
rstCustomers = dbsNorthwind.OpenRecordset("Customers", dbOpenDynaset)
If MsgBox("Do you want to fax invoices" & Chr(13) & _
"to all customers using Microsoft Fax?", 4) = 6 Then
With rstCustomers
Do Until .EOF
' Create the Invoice report Filter used by the Report_Open
' event.
DoCmd.SendObject acReport, "Invoice", acFormatRTF, _
" " & ![E-MAIL] & "", , , , , False
.MoveNext
Loop
End With
End If
rstCustomers.Close
End Function
The abovementioned function would also work great only, I am not able to
insert an attachmnt (f.e. a PDF file) each time a e-mail is being sent, I was
told that it could not be done !
Thanks in advance for any advice or help
I Need a code to send e-mail one by one to e-mail adresses from my Customers
table/Query with the same attachmnt - in my case one single PDF file, I need
it to be done this way as some of the recepients have spam filters and my
e-mail to them gets filtered out!
As I am not real good in code I have tried for hours but with no succes!
This code from Arvin myer is actually what I am lookin for only I need it in
a LOOP function and I need the e-mail adress not to be fixed ,but to be
adress which is in my E-MAIL field from my table, see below
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "(e-mail address removed)"
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With
Exit_Here:
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
Or I also have this function:
Function FaxInvoices()
Dim dbsNorthwind As Database
Dim rstCustomers As Recordset
Set dbsNorthwind = CurrentDb()
Set _
rstCustomers = dbsNorthwind.OpenRecordset("Customers", dbOpenDynaset)
If MsgBox("Do you want to fax invoices" & Chr(13) & _
"to all customers using Microsoft Fax?", 4) = 6 Then
With rstCustomers
Do Until .EOF
' Create the Invoice report Filter used by the Report_Open
' event.
DoCmd.SendObject acReport, "Invoice", acFormatRTF, _
" " & ![E-MAIL] & "", , , , , False
.MoveNext
Loop
End With
End If
rstCustomers.Close
End Function
The abovementioned function would also work great only, I am not able to
insert an attachmnt (f.e. a PDF file) each time a e-mail is being sent, I was
told that it could not be done !
Thanks in advance for any advice or help