Dialogs(xlDialogSendMail).Show - how to delete attachment?

G

Greg Lovern

I'm using a line like this to allow the user to easilty send me an
email:

Application.Dialogs(xlDialogSendMail).Show "(e-mail address removed)", "My
subject"

But it automatically attaches an Excel workbook file. With some older
versions of Excel (I don't recall which versions), I was able to
delete the attachment with sendkeys:

SendKeys "{TAB}{TAB}{TAB}{DELETE}"
Application.Dialogs(xlDialogSendMail).Show "(e-mail address removed)", "My
subject"

But that doesn't work anymore, at least not since Excel 2003.

Is there a way to get rid of that attachment, without the user needing
to manually delete it?


Thanks,

Greg
 
P

Peter T

Public Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long

Sub preEmail()
Dim sEmail As String

sEmail = "mailto:" & "(e-mail address removed)"
sEmail = sEmail & "?subject=The subject"
sEmail = sEmail & "&Body=" & "some body text"
sEmail = sEmail & "%20"

nRes = ShellExecute(GetDesktopWindow(), vbNullString, _
sEmail, vbNullString, _
vbNullString, vbNormalFocus)

End Sub

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top