Hi, im'trying to automate the sending of email from excel using Outlook.
I use this macro:
-----------------
' requires a reference to the Microsoft Outlook 8.0 Object Library
Sub SendAnEmailWithOutlook()
' creates and sends a new e-mail message with Outlook
Dim OLF As Outlook.MAPIFolder, olMailItem As Outlook.MailItem
Dim ToContact As Outlook.Recipient
Set OLF = GetObject("", _
"Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set olMailItem = OLF.Items.Add ' creates a new e-mail message
With olMailItem
.Subject = "Subject for the new e-mail message" ' message subject
Set ToContact = .Recipients.Add("jhon.doe@aol.com") ' add a recipient
.Body = "Hi!" & Chr(13)
' the message text with a line break
'.Attachments.Add "C:\FolderName\Filename.gif", olByValue, , _
"Attachment" ' insert attachment
.Send ' sends the e-mail message (puts it in the Outbox)
End With
Set ToContact = Nothing
Set olMailItem = Nothing
Set OLF = Nothing
End Sub
----------------
What I want to do is to embed the image Filename.gif as the background of the text instead of an attachment like now.
I don't find the correct syntax.
May annyone halp me pelase?
I use this macro:
-----------------
' requires a reference to the Microsoft Outlook 8.0 Object Library
Sub SendAnEmailWithOutlook()
' creates and sends a new e-mail message with Outlook
Dim OLF As Outlook.MAPIFolder, olMailItem As Outlook.MailItem
Dim ToContact As Outlook.Recipient
Set OLF = GetObject("", _
"Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set olMailItem = OLF.Items.Add ' creates a new e-mail message
With olMailItem
.Subject = "Subject for the new e-mail message" ' message subject
Set ToContact = .Recipients.Add("jhon.doe@aol.com") ' add a recipient
.Body = "Hi!" & Chr(13)
' the message text with a line break
'.Attachments.Add "C:\FolderName\Filename.gif", olByValue, , _
"Attachment" ' insert attachment
.Send ' sends the e-mail message (puts it in the Outbox)
End With
Set ToContact = Nothing
Set olMailItem = Nothing
Set OLF = Nothing
End Sub
----------------
What I want to do is to embed the image Filename.gif as the background of the text instead of an attachment like now.
I don't find the correct syntax.
May annyone halp me pelase?