473,385 Members | 1,320 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,385 software developers and data experts.

Using VBA to email w/ attachments

2
Hello!

I'm trying to send out Outlook emails using VBA in Excel. I have a list of email recipients and variablized file names and locations listed out in Excel. I've used the SendMail function before to email out a workbook that's currently open and active, but it looks like that function won't allow any other attachments. What function can I use that will let me attach 2 files to one email?

I even went straight to the bookstore after work on a Friday night (tonight) because I'm dying to figure this out. But alas, I couldn't find anything helpful.

I would even be content for somebody to tell me that this isn't even possible... But why the heck wouldn't it be?

Thanks for reading my post,
Frances
Jan 21 '06 #1
3 36973
Hello!

I'm trying to send out Outlook emails using VBA in Excel. I have a list of email recipients and variablized file names and locations listed out in Excel. I've used the SendMail function before to email out a workbook that's currently open and active, but it looks like that function won't allow any other attachments. What function can I use that will let me attach 2 files to one email?

I even went straight to the bookstore after work on a Friday night (tonight) because I'm dying to figure this out. But alas, I couldn't find anything helpful.

I would even be content for somebody to tell me that this isn't even possible... But why the heck wouldn't it be?

Thanks for reading my post,
Frances
Frances, I am looking for the same thing, let me know if you have found out how to do this.
Thanks Doug
dpawloske@jsmcnamara.com
Sep 21 '06 #2
Perhaps, you can find some ideas using the following link:

http://www.rondebruin.nl/sendmail.htm
Sep 21 '06 #3
apa278
2
Frances, I am looking for the same thing, let me know if you have found out how to do this.
Thanks Doug
dpawloske@jsmcnamara.com
Hi Doug,

Here's the Outlook code that I used. You could just keep adding additional Attachments.Add lines for every attachment you'd like to put in the email.

The "^k" (equiv to Ctrl+k) is the keyboard shortcut to run the "Check Names" function, which identifies the recipients listed as being in the Global Address List. "Chr(13)" represents hitting Enter. RecipList, Subject1, Msg, Path2, ExpFile, and TsrFile are all variables I defined earlier in the macro.

Set olApp = New Outlook.Application
Set olNewMail = olApp.CreateItem(olMailItem)
With olNewMail
.Display
.Recipients.Add RecipList
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys ("{TAB}")
SendKeys ("^k")
.Subject = Subject1
.Body = Msg & Chr(13) & Chr(13)
.Attachments.Add Path2 + ExpFile
.Attachments.Add Path2 + TsrFile
.Send
End With
Set olNewMail = Nothing
Set olApp = Nothing

Hope this helps!

Frances
Sep 21 '06 #4

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

Similar topics

6
by: ErwinF | last post by:
Hi there, I would like to know the following: How to send send email attachments using WebDAV in VB .NET? Sample code please................... Thanks for your help.
2
by: Joe George | last post by:
Hi there, How to save email attachments, from exchange, using WebDAV in C#.NET? Sample code please................... Thanks for your help. -- Joe George
1
by: Steve Holden | last post by:
I'm having some trouble getting attachments right for all recipients, and it seems like Apple's mail.app is the pickiest client at the moment. It doesn't handle attachments that both Thunderbird...
2
by: David Veeneman | last post by:
My web app creates several temporary files, then attaches them to an email that it sends out. When the app attches the documents to the email, .NET locks the files. My problem is that they aren't...
0
by: jackiewkc | last post by:
Hi, Does anyone know how to use VB to write a simple MAPI to save email attachments from a specified email address to my hard drive? What I basically want is that everytime when I receive an...
3
by: olafmol | last post by:
Hello, i want to write a PHP4 script that reads POP3 or IMAP mail and can decode the possible attachments in the email. I've looked around for some classes to do this, and found a few, but most...
1
by: shil | last post by:
Is there any possible way to create an email attachments from an URL in windows vb.net application? I'm using frame work 2.0, System.Net.Mail component. If I attach a file from my file system,...
1
by: netLynx | last post by:
Hi, I am rewriting code from VB6 using MAPI into VB.NET I need to read an attachment off an email on an Exchange Server. In the old VB6 (not written by me) they restrict the Messages.type to...
0
by: =?Utf-8?B?amVhbm9mbWlubmVhcG9saXM=?= | last post by:
I am having problems opening email attachments when I receive as a Notepad. I have this problem in AOL or Outlook. When I open I get a box with letters, symbols and numbers. I have been told as...
1
by: rottmanj | last post by:
So after a few hours of playing with my config file, I think I have it to a point where I am ready to start adding in the rest of the components to my perl application. One thing that I know I need...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.