Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
raj raj is offline
external usenet poster
 
Posts: 32
Default Unsaved file as E-mail attachment

Please help me if you can.

I have developed code that will copy certain portions of
data to a temp file that is then to be attached to an e-
mail message using Outlook. After the e-mail is sent, the
program will close the temp file without saving it.

I'd really like to keep the code this way.

Does anyone know how to attach and send an UNSAVED Excel
file using Outlook? Your EXAMPLE code is vital to me.
Below is my code so far:

Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim strFile As String

Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)

With olMail
.To = <Recipient
.Subject = <Subject
.Body = <Body
.Attachments.Add <File
.Send
End With

Set olMail = Nothing
Set olApp = Nothing

THANKS MUCH IN ADVANCE FOR YOUR ASSISTANCE!!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Unsaved file as E-mail attachment

raj

I don't know how to attach an unsaved file, but you can save it and delete
it.

Fname = "C:\MyAttachemnt.xls"

ActiveWorkbook.SaveAs Fname

olMail.Attachments.Add Fname

ActiveWorkbook.Close False

Kill Fname

The Kill statement deletes it from the harddrive.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"raj" wrote in message
...
Please help me if you can.

I have developed code that will copy certain portions of
data to a temp file that is then to be attached to an e-
mail message using Outlook. After the e-mail is sent, the
program will close the temp file without saving it.

I'd really like to keep the code this way.

Does anyone know how to attach and send an UNSAVED Excel
file using Outlook? Your EXAMPLE code is vital to me.
Below is my code so far:

Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim strFile As String

Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)

With olMail
.To = <Recipient
.Subject = <Subject
.Body = <Body
.Attachments.Add <File
.Send
End With

Set olMail = Nothing
Set olApp = Nothing

THANKS MUCH IN ADVANCE FOR YOUR ASSISTANCE!!!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
e Mail attachment La Blonde New Users to Excel 3 April 12th 10 04:05 PM
how to add attachment in a CDO mail Julaf Excel Discussion (Misc queries) 20 August 19th 08 04:36 PM
mail and attachment Jithu Excel Discussion (Misc queries) 1 July 9th 07 12:38 PM
E-Mail attachment to same e-mail address in Outlook Vick Excel Discussion (Misc queries) 4 May 17th 07 07:53 PM
how to e-mail with an attachment using hotmail Excel not working with hotmail Excel Worksheet Functions 0 February 6th 05 06:35 PM


All times are GMT +1. The time now is 12:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"