F
fre
The folowing code is called to by a button. It creates and sends
email with the Current work as an attachment and works just fine. The
problem I am having it that I want to modify the code to create the
email, but NOT send it. This way they can manually add the persons to
the email. Could someone please help me do this?
----------------------------------------------------
Sub Button6_Click()
Dim OL As Object ' Outlook instantiation
Dim EmailItem As Object ' A new mail item (e-mail)
Dim FileName As String ' The name of the file we are attaching
Dim StyleName As String ' Email Subject
Dim TempName As String ' Cell Contents
Application.EnableEvents = False
Set OL = CreateObject("Outlook.Application") ' New Outlook
application
Set EmailItem = OL.CreateItem(olMailItem) ' new MailItem
StyleName = "Email sUBJECT" ' Email Subject
FileName = "ATTACHMENT.xls" ' Attachment File Name
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "C:\" & FileName ' file attachment location
'On Error Resume Next
With EmailItem ' with the created e-mail
.Subject = StyleName
.Body = Cells(25, 6).Value
.To = "(e-mail address removed)"
.Importance = olImportanceHigh ' Set Importance
.Attachments.Add "C:\" & FileName
.Send ' send the worksheet
End With
ActiveWorkbook.Close False ' Close workbook without saving
Application.ScreenUpdating = True ' Return to normal
Application.EnableEvents = True
Application.DisplayAlerts = True
Application.Quit
End Sub
----------------------------------------------------
email with the Current work as an attachment and works just fine. The
problem I am having it that I want to modify the code to create the
email, but NOT send it. This way they can manually add the persons to
the email. Could someone please help me do this?
----------------------------------------------------
Sub Button6_Click()
Dim OL As Object ' Outlook instantiation
Dim EmailItem As Object ' A new mail item (e-mail)
Dim FileName As String ' The name of the file we are attaching
Dim StyleName As String ' Email Subject
Dim TempName As String ' Cell Contents
Application.EnableEvents = False
Set OL = CreateObject("Outlook.Application") ' New Outlook
application
Set EmailItem = OL.CreateItem(olMailItem) ' new MailItem
StyleName = "Email sUBJECT" ' Email Subject
FileName = "ATTACHMENT.xls" ' Attachment File Name
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "C:\" & FileName ' file attachment location
'On Error Resume Next
With EmailItem ' with the created e-mail
.Subject = StyleName
.Body = Cells(25, 6).Value
.To = "(e-mail address removed)"
.Importance = olImportanceHigh ' Set Importance
.Attachments.Add "C:\" & FileName
.Send ' send the worksheet
End With
ActiveWorkbook.Close False ' Close workbook without saving
Application.ScreenUpdating = True ' Return to normal
Application.EnableEvents = True
Application.DisplayAlerts = True
Application.Quit
End Sub
----------------------------------------------------