Multiple Report Sending

D

Diogo

Hi, need help with the following problem:
I would like to send several reports to serveral adresses, but I would like
to attach all the reports in the same e-mail message instead of one mail for
each report.
Can this be done?
Thanks for the help.
 
C

Carl Rapson

Diogo said:
Hi, need help with the following problem:
I would like to send several reports to serveral adresses, but I would
like
to attach all the reports in the same e-mail message instead of one mail
for
each report.
Can this be done?
Thanks for the help.

Sure it can be done. You don't say what your email program is, but if it's
Outlook you can use automation to create an Outlook mail message and attach
each report. You'll need to save each report as a file (I use .SNP but your
needs may vary) before you can attach it. All of that can be done through
VBA code.

As far as I know, there's no way to send multiple reports with a single
SendObject call. However, one thing you could try is to create a sort of
"comprehensive" report containing each report you really want as a
subreport, then use SendObject on that report. I've never done that, but it
should work.

Carl Rapson
 
D

Diogo

Where can I find that VBA code?

Carl Rapson said:
Sure it can be done. You don't say what your email program is, but if it's
Outlook you can use automation to create an Outlook mail message and attach
each report. You'll need to save each report as a file (I use .SNP but your
needs may vary) before you can attach it. All of that can be done through
VBA code.

As far as I know, there's no way to send multiple reports with a single
SendObject call. However, one thing you could try is to create a sort of
"comprehensive" report containing each report you really want as a
subreport, then use SendObject on that report. I've never done that, but it
should work.

Carl Rapson
 
C

Carl Rapson

Which VBA code? For automating Outlook? Each developer writes his/her own
code for that. You might be able to find some examples by searching these
newsgroups. You can also look in Access help, or pick up a good Access
reference book. I won't write the code for you, but here is a quick overview
(this is what has worked for me):

1) Create variables to hold the Outlook objects you create
Dim Outlook_Object As Object
Dim Outlook_Message As Object
Dim Message_Recipient As Object
Dim Attachments As Object

2) Create your Outlook objects
Set Outlook_Object = CreateObject("Outlook.Application")
Set Outlook_Message = Outlook_Object.CreateItem(0)
Set Message_Recipient = Outlook_Message.Recipients.Add("your list of
recipients here")
Message_Recipient.Type = 1

3) Give the message a subject
Outlook_Message.Subject = "Subject line"

4) Include a message body if you wish
Outlook_Message.Body = "Message body text"

5) Attach the report files
Set Attachments = Outlook_Message.Attachments
Attachments.Add ("full path name of each report file")

6) Send the email
Outlook_Message.Display ' If you want to preview the message before
it's sent
Outlook_Message.Send ' Send without preview

7) Clean up
Set Attachments = Nothing
Set Message_Recipient = Nothing
Set Outlook_Message = Nothing
Set Outlook_Object = Nothing

As for creating .SNP files from reports, look in Access help for OpenReport.

Carl Rapson
 
D

Diogo

What goes inside ("Outlook.Application") in:

Set Outlook_Object = CreateObject("Outlook.Application")

Is it the path of my outlook.exe file?
 
C

Carl Rapson

No, that's literal. You're opening an instance of Outlook. It should be
typed exactly as shown.

Carl Rapson
 

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