473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Send an e-mail with an attachment using Access

Hey,

I am in the process of writing some VBA code that will do the following:

1) Create and send an e-mail using Outlook with an excel file attached. The excel files are present in a specified folder.

Any help to accomplish this will be highly appreciated.

Thanks.
Mar 15 '07 #1
2 1784
MMcCarthy
14,534 Expert Mod 8TB
Hey,

I am in the process of writing some VBA code that will do the following:

1) Create and send an e-mail using Outlook with an excel file attached. The excel files are present in a specified folder.

Any help to accomplish this will be highly appreciated.

Thanks.
Excel has a sendMail command
Expand|Select|Wrap|Line Numbers
  1.     Set wb = ActiveWorkbook
  2.     With wb
  3.         .SendMail "email address", _
  4.             "Subject line"
  5.         .Close False
  6.     End With
  7.  
You would have to nest this into a loop to run through and open each of the excel files.

Mary
Mar 17 '07 #2
Hi,
I've always used this:
Expand|Select|Wrap|Line Numbers
  1.  On Error GoTo cmdEmail_Err
  2.     DoCmd.SendObject acSendQuery, "qryName", acFormatXLS, "", "", "", " See attachment", "", True, ""
  3. cmdEmail_Exit:
  4.     Exit Sub
  5.  
  6. cmdEmail_Err:
  7.     MsgBox "You cancelled and did not send the email", vbExclamation
  8.     Resume cmdEmail_Exit
  9.  
  10.     DoCmd.SetWarnings True
  11.     Me.Refresh
  12.  
Hope that helps.
Matt
Apr 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tom Brown | last post by:
Hi, I have what seems to be a simple problem. But I can not for the life of me find a way to send an integer over a socket. The send method will only accept strings. Here is what I am trying to...
0
by: Piotr Bieniek | last post by:
Hello, I have a problem with UDP sockets. It concerns UdpClient class as well. It throws strange exceptions on subsequent Send calls. Exception is SocketException with native error code 10049. I...
9
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the...
0
by: Markus Poehler | last post by:
Hi there! I have created NT Service that runs on a Server. It should NET SEND to a specifiv Client in a special case of environment. It does NOT net send. The Messenger Service is running....
1
by: charlies224 | last post by:
Hi, I am writting a software that requires me to make sure the Num Lock is always on and Caps Lock is always off. First, I know how to detect if Num Lock or Caps Lock is on or off (if...
2
by: eSolTec, Inc. 501(c)(3) | last post by:
I'm looking for code samples to send a jpg image from a client machine to a host machine. Both have the same image picWindows picture container. I would like to be able to send the image on one...
11
by: Phil Hunt | last post by:
I am porting an VB6 program to .NET C# There is a NET SEND command in the VB6 program. Just wondering if there is any thing similar in the framework. Thanks.
4
by: gvijayaratnam | last post by:
Hi All, I have a fn prototype as follows void print ( char *Buffer, usigned long bufferSize, int chunkSize ); This fn will accept binary file buffer and the buffer size and the chunk size,...
2
by: SvenV | last post by:
I based my program on the asynchronous client/server example on msdn. There weren't too many modifications to the original code. I just created some extra code to response to different messages. F.e....
7
by: Thomas Mlynarczyk | last post by:
Hello, I was playing around a bit with generators using next() and send(). And I was wondering why an extra send() method was introduced instead of simply allowing an argument for next(). ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.