consultwithmoses
New Member
- Joined
- Jan 25, 2005
- Messages
- 2
Hello, I am working on a project that requires me to make a VBA that will e-mail one sheet. I have read through the message boards and cannot find one that will open the e-mail so that the user can add their own text.
This code (found on this site) works, but does not open the e-mail message so the user can add their own message.
Sub Mail_ActiveSheet()
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 _
& ".xls"
.SendMail "consultwithmoses@aol.com", _
"This is the Subject line"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub
(It also will not delete the temp file)
---------------
This code (found on the internet) works, but does not copy the information from one worksheet.
Sub Mail_ActiveSheetAGAIN()
Dim myOutlook As Object
Dim myMailItem As Object
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(olMailItem)
fName = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
With otlNewMail
.To = "consultwithmoses@aol.com"
.body = "This is a test" & Chr(13) & "Regards," & Chr(13) & "Consultwithmoses" & Chr(13) & Chr(13)
.Attachments.Add fName
.Display
End With
Set otlNewMail = Nothing
Set otlApp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing
End Sub
Thank you for your time,
(help...)
This code (found on this site) works, but does not open the e-mail message so the user can add their own message.
Sub Mail_ActiveSheet()
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 _
& ".xls"
.SendMail "consultwithmoses@aol.com", _
"This is the Subject line"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub
(It also will not delete the temp file)
---------------
This code (found on the internet) works, but does not copy the information from one worksheet.
Sub Mail_ActiveSheetAGAIN()
Dim myOutlook As Object
Dim myMailItem As Object
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(olMailItem)
fName = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
With otlNewMail
.To = "consultwithmoses@aol.com"
.body = "This is a test" & Chr(13) & "Regards," & Chr(13) & "Consultwithmoses" & Chr(13) & Chr(13)
.Attachments.Add fName
.Display
End With
Set otlNewMail = Nothing
Set otlApp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing
End Sub
Thank you for your time,
(help...)