Create but don't send an email from Excel

SimonH

New Member
Joined
Jun 2, 2009
Messages
7
Hi all,

I've got the code to send an excel file as an attachment to an email which works perfectly. But I've just been asked by the users if I can make Excel create the email with attachment/recipients already in place but allow the user to enter whatever text they want in the body of the email before its sent.

The file being sent is already formatted to be viewed on the screen without needing to scroll left/right/up/down to see the contents so there isn't really any room for a cell to used for the email content. So I need the actual email to remain open and the user to hit the send button after editing the text, or a box to pop up in excel for them to add any text they want included.

Any ideas? I've been searching and trying things but not managed to solve the issue yet....so its time to call in the experts.

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Do you do a .Send to send the email?

If so, do .Display instead.
 
Upvote 0
I use .SendMail

I've tried changing to .Display and .DisplayMail but neither of these seem to do anything. The code I have is as follows, in case this helps narrow down where I'm going wrong :

Sub Mail_Range()
Dim MyCell
MyCell = Range("K13").Value


Sheets("Calculation").Range("AA9").Value = Application.UserName

'Working in 2000-2007
Dim Source As Range
Dim Dest As Workbook
Dim wb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
Dim FileFormatNum As Long

Set Source = Nothing
On Error Resume Next
Set Source = Range("Print_Area")
On Error GoTo 0

If Source Is Nothing Then
MsgBox "The source is not a range or the sheet is protected, " & _
"please correct and try again.", vbOKOnly
Exit Sub
End If

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set wb = ActiveWorkbook
Set Dest = Workbooks.Add(xlWBATWorksheet)

Source.Copy
With Dest.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial Paste:=xlPasteValues
.Cells(1).PasteSpecial Paste:=xlPasteFormats
.Cells(1).Select
Application.CutCopyMode = False
End With

TempFilePath = Environ$("temp") & "\"
TempFileName = MyCell & " " & Format(Now, "dd-mmm-yy hmm")

If Val(Application.Version) < 12 Then
'You use Excel 2000-2003
FileExtStr = ".xls": FileFormatNum = -4143
Else
'You use Excel 2007
FileExtStr = ".xlsx": FileFormatNum = 51
End If

With Dest
.SaveAs TempFilePath & TempFileName & FileExtStr, _
FileFormat:=FileFormatNum
On Error Resume Next



.SendMail ("
email address is here"), _
MyCell & " Trade Order " & Format(Now, "dd-mmm-yy hmm")
On Error GoTo 0
.Close SaveChanges:=False
End With

Kill TempFilePath & TempFileName & FileExtStr
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top