Sending multiple query's in one attachment (email)

G

Guest

I send three query's (as excel spreadsheets) on a daily basis with the send
object command in a macro. How can I combine these three query's to be sent
in one email, one file, three seperate tabs (or Sheets) within one
spreadsheet?

Thank You.
 
R

Rick Wannall

I used the vb below to transfer 3 queries out to a single spreadsheet. The
spreadsheet did not exist to begin with. The first transfer creates it,
silently. The second two append worksheets, silently. You may want to do
some checking before the transfer so react to the file's existence or
nonexistence before doing the transfer. Depends on how your app is written.

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "query2",
"c:\projects\currentdevelopment\TestMultipleQueryExport.xls", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "query20",
"c:\projects\currentdevelopment\TestMultipleQueryExport.xls", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "query21",
"c:\projects\currentdevelopment\TestMultipleQueryExport.xls", True
 
R

Rick Wannall

I used the vb below to transfer 3 queries out to a single spreadsheet. The
spreadsheet did not exist to begin with. The first transfer creates it,
silently. The second two append worksheets, silently. You may want to do
some checking before the transfer so react to the file's existence or
nonexistence before doing the transfer. Depends on how your app is written.

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "query2",
"c:\projects\currentdevelopment\TestMultipleQueryExport.xls", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "query20",
"c:\projects\currentdevelopment\TestMultipleQueryExport.xls", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "query21",
"c:\projects\currentdevelopment\TestMultipleQueryExport.xls", True
 
G

Guest

Rick, thanks for the response. However, is there anything that I can do
without using code? Not too much of a code person....Can I just use basic
Macro functionality?
Thanks again.
 
G

Guest

Rick, thanks for the response. However, is there anything that I can do
without using code? Not too much of a code person....Can I just use basic
Macro functionality?
Thanks again.
 
P

Pieter Wijnen

Just copy the code into the OnClick Event of a Command Button (Code
Builder)
& Modify the Parameters (Pressing F1 when the text cursor is somewhere
inside "TransferSpreadSheet" will show help)
TransferSpreadsheet can also be used in a macro (All DoCmd *are* macro
actions), but you won't be able to set all possible parameters

HTH

Pieter

"Send Object Command - Two attachments"
 
P

Pieter Wijnen

Just copy the code into the OnClick Event of a Command Button (Code
Builder)
& Modify the Parameters (Pressing F1 when the text cursor is somewhere
inside "TransferSpreadSheet" will show help)
TransferSpreadsheet can also be used in a macro (All DoCmd *are* macro
actions), but you won't be able to set all possible parameters

HTH

Pieter

"Send Object Command - Two attachments"
 

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

Similar Threads

SendObject 5
Email multiple reports 1
Sending multiple query's in one spreadsheet 2
Emailing multiple reports in Access 0
Error #2950 3
Table cleanup 3
sendObject sends too many files 3
Form for Query Criteria 6

Top