View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Saving then Delete Workbook

hi,
Try something like this.....
Sub SaveSendDelete()
Dim StrPath As String
Dim StrFileName As String
Dim StrToDelete As String
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\Book1.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkBook.Close

' your email macro

StrPath = "c:\" ' the folder path
StrFileName = InputBox("Enter File Name")
StrToDelete = StrPath & StrFileName & ".xls"
On Error GoTo Err
Kill StrToDelete
MsgBox ("File " & StrFileName & ".xls" & " deleted!")
Exit Sub
Err: MsgBox "Whao!! ERROR!!! File NOT deleted!!"
End Sub

since i have not seen your email macro....edit above to fit your machine.
worked on my machine. except for the email part. using xp

regards
FSt1

"Vick" wrote:

Is there a way to save a temp file so that I can send an e-mail then have it
delete when the e-mail is sent? I'm using a macro to send the e-mail.