Need code to send e-mail one by one with attachmnt *1092008

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
 
W

Wayne-I-M

Hi

Creat a list box with a number of column (?) one of which should the e mail
address you want to mail to - you could call it MyList

Public Sub emailall_Click()

Dim varItem As Variant

'select all items on list box'
With Me.MyList
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.MyList.ItemsSelected

'***Add your send e mail code here***'

'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the send'
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")

End Sub


This is quite simple but it's much better (from the person getting the e
mail's point of view) to have a personalised e mail.

So you could add a "rename" to the code to copy the PDF then rename it (take
the name from one of your list columns - John's PDF, Mike's PDF - Office
PDF, Catering PDF, etc) - send the mail, delete the copy and then do it again
for the next person. You can add something like Hi John, Sally, Mike, etc
here is the e mail you wanted.

You can add the date to the e mail header, etc etc, etc, etc

Good luck

--
Wayne
Manchester, England.



J.Alladien said:
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
 
J

J.Alladien

Hi Wayne,

Thanks a lot for helping me out, I came out with the following and I am sure
I did something wrong, I did everything like you instructed and came out with
this, please bear with me as I am a very weak with code :


Private Sub emailall_Click()
Dim varItem As Variant

'select all items on list box'
With Me.Mylist
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.Mylist.ItemsSelected

On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = (.ListCount - 1)
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Documents and Settings\earl.JETZZA\Desktop\ALARM.pdf"
'.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






'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the Send '
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")


End Sub

When I run this I get "438; OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD"

Do I need to check an extra referance or something, thanks in advance for
any advice!


Wayne-I-M said:
Hi

Creat a list box with a number of column (?) one of which should the e mail
address you want to mail to - you could call it MyList

Public Sub emailall_Click()

Dim varItem As Variant

'select all items on list box'
With Me.MyList
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.MyList.ItemsSelected

'***Add your send e mail code here***'

'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the send'
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")

End Sub


This is quite simple but it's much better (from the person getting the e
mail's point of view) to have a personalised e mail.

So you could add a "rename" to the code to copy the PDF then rename it (take
the name from one of your list columns - John's PDF, Mike's PDF - Office
PDF, Catering PDF, etc) - send the mail, delete the copy and then do it again
for the next person. You can add something like Hi John, Sally, Mike, etc
here is the e mail you wanted.

You can add the date to the e mail header, etc etc, etc, etc

Good luck

--
Wayne
Manchester, England.



J.Alladien said:
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
 
W

Wayne-I-M

Hi

No time at the moment - I will do it later when get home unless someone else
jumps in the code. - Wait about 3 hours

Sorry - must work now and again :)

--
Wayne
Manchester, England.



J.Alladien said:
Hi Wayne,

Thanks a lot for helping me out, I came out with the following and I am sure
I did something wrong, I did everything like you instructed and came out with
this, please bear with me as I am a very weak with code :


Private Sub emailall_Click()
Dim varItem As Variant

'select all items on list box'
With Me.Mylist
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.Mylist.ItemsSelected

On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = (.ListCount - 1)
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Documents and Settings\earl.JETZZA\Desktop\ALARM.pdf"
'.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






'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the Send '
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")


End Sub

When I run this I get "438; OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD"

Do I need to check an extra referance or something, thanks in advance for
any advice!


Wayne-I-M said:
Hi

Creat a list box with a number of column (?) one of which should the e mail
address you want to mail to - you could call it MyList

Public Sub emailall_Click()

Dim varItem As Variant

'select all items on list box'
With Me.MyList
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.MyList.ItemsSelected

'***Add your send e mail code here***'

'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the send'
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")

End Sub


This is quite simple but it's much better (from the person getting the e
mail's point of view) to have a personalised e mail.

So you could add a "rename" to the code to copy the PDF then rename it (take
the name from one of your list columns - John's PDF, Mike's PDF - Office
PDF, Catering PDF, etc) - send the mail, delete the copy and then do it again
for the next person. You can add something like Hi John, Sally, Mike, etc
here is the e mail you wanted.

You can add the date to the e mail header, etc etc, etc, etc

Good luck

--
Wayne
Manchester, England.



J.Alladien said:
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
 
J

J.Alladien

Ok , no prob Wayne Thanks , Till later then!

Wayne-I-M said:
Hi

No time at the moment - I will do it later when get home unless someone else
jumps in the code. - Wait about 3 hours

Sorry - must work now and again :)

--
Wayne
Manchester, England.



J.Alladien said:
Hi Wayne,

Thanks a lot for helping me out, I came out with the following and I am sure
I did something wrong, I did everything like you instructed and came out with
this, please bear with me as I am a very weak with code :


Private Sub emailall_Click()
Dim varItem As Variant

'select all items on list box'
With Me.Mylist
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.Mylist.ItemsSelected

On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = (.ListCount - 1)
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Documents and Settings\earl.JETZZA\Desktop\ALARM.pdf"
'.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






'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the Send '
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")


End Sub

When I run this I get "438; OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD"

Do I need to check an extra referance or something, thanks in advance for
any advice!


Wayne-I-M said:
Hi

Creat a list box with a number of column (?) one of which should the e mail
address you want to mail to - you could call it MyList

Public Sub emailall_Click()

Dim varItem As Variant

'select all items on list box'
With Me.MyList
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.MyList.ItemsSelected

'***Add your send e mail code here***'

'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the send'
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")

End Sub


This is quite simple but it's much better (from the person getting the e
mail's point of view) to have a personalised e mail.

So you could add a "rename" to the code to copy the PDF then rename it (take
the name from one of your list columns - John's PDF, Mike's PDF - Office
PDF, Catering PDF, etc) - send the mail, delete the copy and then do it again
for the next person. You can add something like Hi John, Sally, Mike, etc
here is the e mail you wanted.

You can add the date to the e mail header, etc etc, etc, etc

Good luck

--
Wayne
Manchester, England.



:

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
 
W

Wayne-I-M

Hi

Sorry for not getting back to you yesterday.

Instead of sending you one of my codes - which tend to be for specific uses
are are a little strange as they will work if you have all the other "bits"
we have, have a look at this from the MS site as it will give the standard
method. You can add "tuff" to it later after you have the basics working

http://support.microsoft.com/kb/209948

Hope this helps

--
Wayne
Manchester, England.



J.Alladien said:
Ok , no prob Wayne Thanks , Till later then!

Wayne-I-M said:
Hi

No time at the moment - I will do it later when get home unless someone else
jumps in the code. - Wait about 3 hours

Sorry - must work now and again :)

--
Wayne
Manchester, England.



J.Alladien said:
Hi Wayne,

Thanks a lot for helping me out, I came out with the following and I am sure
I did something wrong, I did everything like you instructed and came out with
this, please bear with me as I am a very weak with code :


Private Sub emailall_Click()
Dim varItem As Variant

'select all items on list box'
With Me.Mylist
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.Mylist.ItemsSelected

On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = (.ListCount - 1)
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Documents and Settings\earl.JETZZA\Desktop\ALARM.pdf"
'.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






'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the Send '
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")


End Sub

When I run this I get "438; OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD"

Do I need to check an extra referance or something, thanks in advance for
any advice!


:

Hi

Creat a list box with a number of column (?) one of which should the e mail
address you want to mail to - you could call it MyList

Public Sub emailall_Click()

Dim varItem As Variant

'select all items on list box'
With Me.MyList
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

For Each varItem In Me.MyList.ItemsSelected

'***Add your send e mail code here***'

'go to next item on the list and do it again'
Next varItem

'Open Outlook so the mails will send - You need to add a close action after
the send'
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")

End Sub


This is quite simple but it's much better (from the person getting the e
mail's point of view) to have a personalised e mail.

So you could add a "rename" to the code to copy the PDF then rename it (take
the name from one of your list columns - John's PDF, Mike's PDF - Office
PDF, Catering PDF, etc) - send the mail, delete the copy and then do it again
for the next person. You can add something like Hi John, Sally, Mike, etc
here is the e mail you wanted.

You can add the date to the e mail header, etc etc, etc, etc

Good luck

--
Wayne
Manchester, England.



:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top