poleary2000
Active Member
- Joined
- Apr 1, 2002
- Messages
- 354
I am using the following code to send an e-mail. Basically, it copies the cells from a worksheet in the original workbook, opens a new workbook, pastes the information, saves the file and attaches to an Outlook message.
To attach the file, I had to first save the file to the harddrive. What I would like to do is delete the file after the ActiveWorkbook.Close? Can someone help ASAP
Cells.Copy
Set newBook = Workbooks.Add
Cells.PasteSpecial
With newBook
.SaveAs Filename:="blah blah blah"
End With
Dim olApp As Object, olMail As Object
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(0)
olMail.To = strRecipients
olMail.Subject = "blah blah"
olMail.Body = "blah blah"
olMail.Attachments.Add ActiveWorkbook.FullName
olMail.Display
ActiveWorkbook.Close SaveChanges:=False
To attach the file, I had to first save the file to the harddrive. What I would like to do is delete the file after the ActiveWorkbook.Close? Can someone help ASAP
Cells.Copy
Set newBook = Workbooks.Add
Cells.PasteSpecial
With newBook
.SaveAs Filename:="blah blah blah"
End With
Dim olApp As Object, olMail As Object
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(0)
olMail.To = strRecipients
olMail.Subject = "blah blah"
olMail.Body = "blah blah"
olMail.Attachments.Add ActiveWorkbook.FullName
olMail.Display
ActiveWorkbook.Close SaveChanges:=False