469,963 Members | 1,309 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

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 36756
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

Post your reply

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

Similar topics

1 post views Thread by Steve Holden | last post: by
2 posts views Thread by David Veeneman | last post: by
3 posts views Thread by olafmol | last post: by
reply views Thread by =?Utf-8?B?amVhbm9mbWlubmVhcG9saXM=?= | last post: by
1 post views Thread by rottmanj | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.