Delete exports when finished

Timoty

Registered User.
Local time
Today, 05:52
Joined
Jul 29, 2003
Messages
105
Is there anyway to delete my exports once they are emailed from within access. The code so far is as follows:

Dim stDocName As String
Dim EmailApp, NameSpace, EmailSend As Object

DoCmd.OutputTo acReport, "rescasdir", acFormatRTF, "h:\Resolved.rtf"
DoCmd.OutputTo acReport, "bordir", acFormatRTF, "h:\Border.rtf"
DoCmd.OutputTo acReport, "othagdir", acFormatRTF, "h:\Other.rtf"


Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)

EmailSend.To = "my name"
EmailSend.Subject = "Court Updates"
EmailSend.Attachments.Add "h:\border.rtf"
EmailSend.Attachments.Add "h:\other.rtf"
EmailSend.Attachments.Add "h:\resolved.rtf"
EmailSend.Display

Set EmailApp = Nothing
Set NameSpace = Nothing
Set EmailSend = Nothing
 
Investigate the scary-sounding Kill command.
 
Hey Timoty,

you can use either the "Kill" or DoCmd.DeleteObject .

Hope that helps!

-Sean
 
Thanks

The KILL command worked for me. Boy could I have fun with that command =-)
 
I know, couldn't they have called it DeleteFile or something more benign sounding? "Kill" sounds so....final.
 
The use of Kill command is a bit dangerous !!!!

You could use this below statements without a harm way.


DoCmd.SendObject acSendReport, _
"rescasdir", acFormatRTF, _
"my name", , , _
"Court Updates", _
"Please open the attachment file", _
False


This will send the email with an attachment file automatically, without doing the Kill file.

Cheers :)
 
Problem is...

Silent breaker....I wanted to try to avoid exporting the files and your idea is great, except for the fact that I have to send all three reports as attatchments to one email. After searching this forum endlessly it seems that there is no other way to attatch three reports to one email.

If anyone knows another way than What I've done I'd be thrilled to hear about it.
 

Users who are viewing this thread

Back
Top Bottom