PC Review


Reply
Thread Tools Rate Thread

Attaching Files to Outlook

 
 
JT
Guest
Posts: n/a
 
      27th Jan 2010
I have an Excel macro that saves a workbook and sends it to a user at a
specific cost center. Part of the code I am using is below.

I have a new requirement that other cost centers would like to attach backup
files to support the Excel file that gets sent in the e-mail.

I'm looking for some code or suggestions that will allow me to attach the
other files to the e-mail before it is sent. I will have the paths to each
backup file in a array.

Is this possible? Thanks for the help

ActiveWorkbook.SaveAs (vPath & vNewFileName)

On Error GoTo errmsg

ActiveWorkbook.SendMail Array("(E-Mail Removed)", "(E-Mail Removed)"),
Subject:=vNewFileName1 & " !B!A!C!K!U!P!S!"

ActiveWorkbook.Close (False)

MsgBox "Your file has been sent"

Application.StatusBar = "Ready"
Application.DisplayStatusBar = True

--
JT
 
Reply With Quote
 
 
 
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      27th Jan 2010
You'd be better off using the OUtlook Object Model explicitly:

set OlApp = CreateObject("Outlook.Applicartion")
set Msg = OlApp.CreateItem(0)
Msg.To = "(E-Mail Removed); (E-Mail Removed)"
Msg.Subject = "Test"
Msg.Attachments.Add "c:\folder\YourFileName.xls"
Msg.Send

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"JT" <(E-Mail Removed)> wrote in message
news:E5B4F6B8-94B1-44B4-8777-(E-Mail Removed)...
>I have an Excel macro that saves a workbook and sends it to a user at a
> specific cost center. Part of the code I am using is below.
>
> I have a new requirement that other cost centers would like to attach
> backup
> files to support the Excel file that gets sent in the e-mail.
>
> I'm looking for some code or suggestions that will allow me to attach the
> other files to the e-mail before it is sent. I will have the paths to
> each
> backup file in a array.
>
> Is this possible? Thanks for the help
>
> ActiveWorkbook.SaveAs (vPath & vNewFileName)
>
> On Error GoTo errmsg
>
> ActiveWorkbook.SendMail Array("(E-Mail Removed)", "(E-Mail Removed)"),
> Subject:=vNewFileName1 & " !B!A!C!K!U!P!S!"
>
> ActiveWorkbook.Close (False)
>
> MsgBox "Your file has been sent"
>
> Application.StatusBar = "Ready"
> Application.DisplayStatusBar = True
>
> --
> JT



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching files to Outlook JT Microsoft Excel Programming 1 27th Jan 2010 03:51 PM
Attaching files in Word 2000 like attaching files to email =?Utf-8?B?UyB0cmFpbmVy?= Microsoft Word Document Management 1 23rd Dec 2006 08:54 PM
Outlook and attaching Zip files =?Utf-8?B?V2FuZGE=?= Microsoft Outlook Discussion 0 9th Nov 2004 03:43 PM
Attaching Files to Outlook Richard Microsoft Outlook Discussion 1 9th Mar 2004 05:13 PM
attaching files in Outlook PJDourm Microsoft Outlook 1 20th Jan 2004 03:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:56 PM.