![]() |
Saving then Delete Workbook
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. |
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. |
All times are GMT +1. The time now is 07:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com