SendObject

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

I have created a macro to email a table as an excel file automatically,
however, I now need to send 2 tables to the same person, I have tried
several ways of changing the code but nothing seems to work, can anyone tell
me if this is possible within the same email and if so, what is the correct
SQL syntax?

Thanks
 
Keith,

It is not possible to do this directly with a macro. Apart from using
two SendObject actions in your macro to send two separate emails, the
only way around it in a macro would be:
- use an OutputTo action, or TransferSpreadsheet action, to export the
first table to an Excel file, save to your disk.
- use a SendObject action for the second table, with the Edit Message
argument set to Yes
- when the email opens in your email client, with the second Excel
file already attached, you would then have to manually attach the first
one before sending

As far as I know, assuming you are using Outlook for email, the best
approach here, if you really want them both to go on the one email, is
to use Office Automation in a VBA procedure to send the email, in which
case you can manipulate the attachments. You will find some good
information at http://www.granite.ab.ca/access/email.htm
 
Keith,
If the two queries have essentially the same output columns then you
might combine them into one by using a union query.

Good luck,
Mattias

From: Keith, on 4/3/2007 1:45 AM:
 
No, they are from 2 completely different tables, one has 10 columns of data,
1 has 28 columns.

Thanks anyway.
 
Keith,

Another thought... If you are using TransferSpreadsheet actions in your
macro, even though Help says it is only for import, it actually works to
specify the Range argument for Export of data as well. Therefore,
without having tested it at all, this might work... Export the data
from one table to Sheet2 of the Excel file using a Transfer Spreadsheet
action, and then try the SendObject with the other table, presumably
this will go to Sheet1, and then you will have both tables' data on the
same Excel file. Just a thought...
 
Back
Top