Question spreadsheets to be via email (1 Viewer)

dark11984

Registered User.
Local time
Today, 20:07
Joined
Mar 3, 2008
Messages
129
I have a table of data that I would like to send as an excel spreadsheet as an attachment via email. I want to be able to do this by clicking a command button.

In a second table I have all the employees email addresses that I want to send it to.

I also don't want everybody to get the same spreadsheet. i only want to send the data that belongs to each person. eg: records 1, 2 & 4 are to be sent to john and records 3, 5 & 6 are to be sent to phil.
 

John Big Booty

AWF VIP
Local time
Today, 20:07
Joined
Aug 29, 2005
Messages
8,263
Try this

Code:
Dim stDocName As String
Dim stToName As String
Dim stCCName As String
Dim stBCCName As String
Dim stSubject As String
Dim stMessage As String

stDocName = "Table, Query or Report Name" 'Below in Docmd insert acSendTable for table, acSendReport for report or acSendQuery for query
stToName = "Insert to email adresses" 'This could also be a field picked up by your query or report
stCCName = "Insert cc email adresses" 'This could also be a field picked up by your query or report
stBCCName= "Insert bcc email adresses" 'This could also be a field picked up by your query or report
stSubject = "Subject text"
stMessage = "Message" 'This could also be a field picked up by your query or report


DoCmd.SendObject acSendTable, stDocName, acFormatXLS, stToName,stCCName ,stBCCName , stSubject, stMessage
 
Last edited:

Users who are viewing this thread

Top Bottom