LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Sending email from Excel

Hi Denise,

Thanks for posting in the community.

The two problems I have a

1) I know the address that I want to mail to but I want to stop in the
remarks section to attach digital photos or make additional comments before
sending the worksheet.
2) When I entered the email address within the "" and used the .Display
method, the code did not work. So I decided to omit the email address so
the form will stop in outlook. I am not experienced enough to understand
all the other codes within the site. Any other suggestions you can offer
would greatly be appreciated. My main goal is to have the email address
populated with the worksheet in the body as an attachment, and add any
additional comments.

If you wants to customize procedure to send mail , you should not the use
the ActiveWorkbook.SendMail method, since the method will just sent a
workbook.
You need to automation the outlook application to achieve your aim as
Tom's suggestion. Why do you need to stop? You may add the file to the
attachments you want to send as attachment.

This code below works on my machine, it will display the outlook and stop
here.

Sub Mail_ActiveSheet_Outlook()
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strdate & ".xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add wb.FullName
.Display
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sending email attachment from excel mayer Excel Discussion (Misc queries) 0 July 25th 08 08:33 PM
Sending email from excel spreadsheet writer Excel Discussion (Misc queries) 2 August 8th 07 12:26 PM
Sending an email with Excel macro Ralph Excel Discussion (Misc queries) 0 December 22nd 06 12:50 AM
sending email in Excel Peter W[_2_] Excel Programming 1 September 15th 03 04:13 PM
HELP sending email from Excel Memnoch Excel Programming 0 July 12th 03 02:18 PM


All times are GMT +1. The time now is 03:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"