ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dialogs(xlDialogSendMail).Show - how to delete attachment? (https://www.excelbanter.com/excel-programming/427609-dialogs-xldialogsendmail-show-how-delete-attachment.html)

Greg Lovern

Dialogs(xlDialogSendMail).Show - how to delete attachment?
 
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

Peter T

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




Greg Lovern

Dialogs(xlDialogSendMail).Show - how to delete attachment?
 
Wow, thanks! That's great.

Greg



All times are GMT +1. The time now is 12:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com