View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default excel programming

Hi Pam

Try this


Sub Mail_small_Text_Outlook()
'Working in Office 2000-2007
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = ThisWorkbook.FullName 'or without path use
ThisWorkbook.Name
.Body = strbody
'You can add a file like this
'.Attachments.Add ("C:\test.txt")
.display 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


"Pam M" schreef in bericht
...
My old friend Ron. Thanks for responding! Yes, we use Outlook.

"Ron de Bruin" wrote:

Hi Pam

You need other code to do this
Do you use Outlook ???



"Pam M" schreef in bericht
...
I have a macro that sends an automatic email from Excel to notify that a
file
needs to be reviewed.

Application.Dialogs(xlDialogSendMail).Show _
arg2:="MIX REQUEST: " & [JobName] & ".xls", arg3:=True

This places the filename of the file that needs to be reviewed into the
subject. Because it is going straight from excel, it also attaches the
file.
Which argument in DialogSendMail should be marked false so that the
attachment doesn't go and just the email does?

__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com