View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Dialogs(xlDialogSendMail).Show - how to delete attachment?

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:" & "
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

"Greg Lovern" wrote in message
...
I'm using a line like this to allow the user to easilty send me an
email:

Application.Dialogs(xlDialogSendMail).Show ", "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 ", "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