Send draft message via routine?

P

papou

Hi all
I am using a routine in Excel to send a message to several contacts listed
in my worksheet.
Since I am having some difficulty in declaring the body of my message in
HTML in my code, I thought I could actually save an HTML message in my
drafts Folder in Outlook and then refer to this draft message when running
my routine in Excel.
But I cannot find how to refer to this specific document I want to send? (I
obviously cannot use the Mailitem?)
Could somebody please help me.
TIA

here's the beginning of my routine:
Dim AppOutlk As Outlook.Application
Dim OutlookAeteDemarre As Boolean
Dim MessageOutlk As Outlook.MailItem


Cordially
Pascal
 
P

papou

Hi again
I am nearly finished with my routine but for one thing:
I need to use my draft message several times since I have seeral recepients.
How is it possible to keep my draft message available in the Draft folder
once I have sent the message?
Here's my code below.
TIA

Cordially
Pascal

Public TtxMsg$
Public Chemin$
Sub Testit()
Dim i&
Dim NbContacts&
Chemin = ThisWorkbook.Path & Application.PathSeparator
Dim AppOutlk As Outlook.Application
Dim OutlookAeteDemarre As Boolean
Dim Espace As Outlook.Namespace
Dim LeDossier As Outlook.MAPIFolder
Dim Lemsg As Outlook.Items

On Error Resume Next
Set AppOutlk = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set AppOutlk = CreateObject("Outlook.Application")
OutlookAeteDemarre = True
End If
Dim LaFVx As Worksheet
Set LaFVx = ThisWorkbook.Worksheets("Voeux")
NbContacts = LaFVx.Cells(65536, 1).End(xlUp).Row
'Pour chque ligne users
For i = 1 To NbContacts
Set Espace = AppOutlk.GetNamespace("MAPI")
Set LeDossier = Espace.GetDefaultFolder(olFolderDrafts)
With LeDossier.Items(1)
..Recipients.Add LaFVx.Cells(i, 1).Value
..Send
End With
Next i

'Killer process outlook si demarré
If OutlookAeteDemarre Then AppOutlk.Quit
''libérer les variables
Set AppOutlk = Nothing
Set Lemsg = Nothing
Set LaFVx = Nothing
End Sub
 
M

Michael Bauer

Am Thu, 29 Dec 2005 18:08:14 +0100 schrieb papou:

Pascal, call the Copy function of your draft and send that instead of the
original draft.
 
P

papou

Michael
Forgert my last message I found out how to achieve this.
Many thanks

Cordially
Pascal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top