A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Looks like you replied twice. Did the you have a problem with posting.
The following modified code is untested but should do what you want.
Sub EmailWithOutlook()
'Variable declaration
Dim oApp As Object, _
oMail As Object, _
WB As Workbook, _
FileName As String
'Turn off screen updating
Application.ScreenUpdating = False
'Make a copy of the active sheet and save it to
'a temporary file
ActiveSheet.Copy
Set WB = ActiveWorkbook
'New workbook will have data on worksheet(1).
'Cells is the entire worksheet range of new worksheet
'Copy and PasteSpecial -> Values for entire worksheet
With WB.Worksheets(1).Cells
.Copy
.PasteSpecial xlPasteValues
'Entire worksheet will remain selected so select just first cell
.Range("A1").Select
End With
FileName = "Name of the workbook.xls"
'On Error Resume Next
'Kill "C:" & FileName
'On Error GoTo 0
WB.SaveAs FileName:="C:" & FileName
'Create and show the outlook mail item
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
'Uncomment the line below to hard code a recipient
'.To = "*** Email address is removed for privacy ***"
'Uncomment the line below to hard code a subject
'.Subject = "Look at my workbook!"
.Attachments.Add WB.FullName
.Display
End With
'Delete the temporary file
WB.ChangeFileAccess Mode:=xlReadOnly
'Kill WB.FullName
'WB.Close SaveChanges:=False
'Restore screen updating and release Outlook
Application.ScreenUpdating = True
Set oMail = Nothing
Set oApp = Nothing
End Sub