This works with Outlook. I don't know how to call other email programs from VBA.
Sub sendEmail()
Dim stFileName As String
Dim stFileLocation As String
Dim iQuestion As Integer
stFileName = Range("A1").Value
Range("A4:A67").Copy
Workbooks.Add
Range("A1").PasteSpecial xlPasteAll
stFileLocation = Application.GetSaveAsFilename(InitialFileName:=stFileName)
ActiveWorkbook.SaveAs Filename:=stFileLocation & "txt", FileFormat:=xlText
ActiveWorkbook.Close SaveChanges:=False
iQuestion = MsgBox("Would you like to email the file?", vbYesNo)
If iQuestion = vbYes Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.Attachments.Add stFileLocation & "txt"
.Display
End With
Else: End If
End Sub
Bookmarks