OVH Cloud OVH Cloud

Pb d'envoie de message

4 réponses
Avatar
BL
Bonjour,

J'utilise un code pour créer un message automatique à différent utilisateur.

Mon Probleme vient de notre messagerie (Microsoft outlook 2003) Qui nous
demande si nous donnons l'autorisation t'utilisé le carnet d'adresse et
demande si on autorise d'envoyer le message.

Voisi mon code que j'utilise.
Public Sub SendMessage(destinataire As String, _
Sujet As String, _
Corps As String, _
Optional CopieCC As String, _
Optional PièceJointe As String)

Dim CC As Variant
Dim I As Integer
Dim OL_App As New Outlook.Application
Dim OL_Attach As Outlook.Attachment
Dim OL_Recipient As Outlook.Recipient
Dim OL_Msg As Outlook.MailItem

Set OL_Msg = OL_App.CreateItem(olMailItem)
With OL_Msg
CC = Split(destinataire, ";")
For I = LBound(CC) To UBound(CC)
Set OL_Recipient = .Recipients.Add(CC(I))
OL_Recipient.Type = olTo
Next I
If Not IsMissing(CopieCC) Then
CC = Split(CopieCC, ";")
For I = LBound(CC) To UBound(CC)
If CC(I) <> "" Then
Set OL_Recipient = .Recipients.Add(CC(I))
OL_Recipient.Type = olCC
End If
Next I
End If
.Subject = Sujet
.Body = Corps
.Importance = olImportanceHigh
If Not IsMissing(PièceJointe) Then
CC = Split(PièceJointe, ";")
For I = LBound(CC) To UBound(CC)
If CC(I) <> "" Then
Set OL_Attach = .Attachments.Add(CC(I))
End If
Next I
End If
For Each OL_Recipient In .Recipients
OL_Recipient.Resolve
If Not OL_Recipient.Resolve Then
OL_Msg.Display
Else
.Display ' choisir display ou send
' .Send
End If
Next
End With
OL_Msg.Send
Set OL_Msg = Nothing
Set OL_App = Nothing
Set OL_Attach = Nothing
Set OL_Recipient = Nothing
End Sub

Merci de vos aides.

4 réponses

Avatar
JièL Goubert
Bonjoir© BL

Inspirez vous de ce code plutot
http://www.3stone.be/access/articles.php?lng=fr&pg‰

--
JièL / Jean-Louis GOUBERT
La FAQ Outlook est la : http://faq.outlook.free.fr

Le 30/01/2006 11:13 vous avez écrit... :
Bonjour,

J'utilise un code pour créer un message automatique à différent utilisateur.

Mon Probleme vient de notre messagerie (Microsoft outlook 2003) Qui nous
demande si nous donnons l'autorisation t'utilisé le carnet d'adresse et
demande si on autorise d'envoyer le message.

Voisi mon code que j'utilise.
Public Sub SendMessage(destinataire As String, _
Sujet As String, _
Corps As String, _
Optional CopieCC As String, _
Optional PièceJointe As String)

Dim CC As Variant
Dim I As Integer
Dim OL_App As New Outlook.Application
Dim OL_Attach As Outlook.Attachment
Dim OL_Recipient As Outlook.Recipient
Dim OL_Msg As Outlook.MailItem

Set OL_Msg = OL_App.CreateItem(olMailItem)
With OL_Msg
CC = Split(destinataire, ";")
For I = LBound(CC) To UBound(CC)
Set OL_Recipient = .Recipients.Add(CC(I))
OL_Recipient.Type = olTo
Next I
If Not IsMissing(CopieCC) Then
CC = Split(CopieCC, ";")
For I = LBound(CC) To UBound(CC)
If CC(I) <> "" Then
Set OL_Recipient = .Recipients.Add(CC(I))
OL_Recipient.Type = olCC
End If
Next I
End If
.Subject = Sujet
.Body = Corps
.Importance = olImportanceHigh
If Not IsMissing(PièceJointe) Then
CC = Split(PièceJointe, ";")
For I = LBound(CC) To UBound(CC)
If CC(I) <> "" Then
Set OL_Attach = .Attachments.Add(CC(I))
End If
Next I
End If
For Each OL_Recipient In .Recipients
OL_Recipient.Resolve
If Not OL_Recipient.Resolve Then
OL_Msg.Display
Else
.Display ' choisir display ou send
' .Send
End If
Next
End With
OL_Msg.Send
Set OL_Msg = Nothing
Set OL_App = Nothing
Set OL_Attach = Nothing
Set OL_Recipient = Nothing
End Sub

Merci de vos aides.




Avatar
AA
Je te remarcie pour ta reponse.
Je vais la tester.


"JièL Goubert" a écrit dans le
message de news:
Bonjoir© BL

Inspirez vous de ce code plutot
http://www.3stone.be/access/articles.php?lng=fr&pg‰

--
JièL / Jean-Louis GOUBERT
La FAQ Outlook est la : http://faq.outlook.free.fr

Le 30/01/2006 11:13 vous avez écrit... :
Bonjour,

J'utilise un code pour créer un message automatique à différent
utilisateur.

Mon Probleme vient de notre messagerie (Microsoft outlook 2003) Qui nous
demande si nous donnons l'autorisation t'utilisé le carnet d'adresse et
demande si on autorise d'envoyer le message.

Voisi mon code que j'utilise.
Public Sub SendMessage(destinataire As String, _
Sujet As String, _
Corps As String, _
Optional CopieCC As String, _
Optional PièceJointe As String)

Dim CC As Variant
Dim I As Integer
Dim OL_App As New Outlook.Application
Dim OL_Attach As Outlook.Attachment
Dim OL_Recipient As Outlook.Recipient
Dim OL_Msg As Outlook.MailItem

Set OL_Msg = OL_App.CreateItem(olMailItem)
With OL_Msg
CC = Split(destinataire, ";")
For I = LBound(CC) To UBound(CC)
Set OL_Recipient = .Recipients.Add(CC(I))
OL_Recipient.Type = olTo
Next I
If Not IsMissing(CopieCC) Then
CC = Split(CopieCC, ";")
For I = LBound(CC) To UBound(CC)
If CC(I) <> "" Then
Set OL_Recipient = .Recipients.Add(CC(I))
OL_Recipient.Type = olCC
End If
Next I
End If
.Subject = Sujet
.Body = Corps
.Importance = olImportanceHigh
If Not IsMissing(PièceJointe) Then
CC = Split(PièceJointe, ";")
For I = LBound(CC) To UBound(CC)
If CC(I) <> "" Then
Set OL_Attach = .Attachments.Add(CC(I))
End If
Next I
End If
For Each OL_Recipient In .Recipients
OL_Recipient.Resolve
If Not OL_Recipient.Resolve Then
OL_Msg.Display
Else
.Display ' choisir display ou send
' .Send
End If
Next
End With
OL_Msg.Send
Set OL_Msg = Nothing
Set OL_App = Nothing
Set OL_Attach = Nothing
Set OL_Recipient = Nothing
End Sub

Merci de vos aides.







Avatar
AA
Je te remercie pour ta reponse,
Mais j'ai problème de selection de logiciel.
Se code me prend outlook express au lieu de Microsoft outlook 2003.
Merci de bien vouloire M'aider.
BL


"JièL Goubert" a écrit dans le
message de news:
Bonjoir© BL

Inspirez vous de ce code plutot
http://www.3stone.be/access/articles.php?lng=fr&pg‰

--
JièL / Jean-Louis GOUBERT
La FAQ Outlook est la : http://faq.outlook.free.fr

Le 30/01/2006 11:13 vous avez écrit... :
Bonjour,

J'utilise un code pour créer un message automatique à différent
utilisateur.

Mon Probleme vient de notre messagerie (Microsoft outlook 2003) Qui nous
demande si nous donnons l'autorisation t'utilisé le carnet d'adresse et
demande si on autorise d'envoyer le message.

Voisi mon code que j'utilise.
Public Sub SendMessage(destinataire As String, _
Sujet As String, _
Corps As String, _
Optional CopieCC As String, _
Optional PièceJointe As String)

Dim CC As Variant
Dim I As Integer
Dim OL_App As New Outlook.Application
Dim OL_Attach As Outlook.Attachment
Dim OL_Recipient As Outlook.Recipient
Dim OL_Msg As Outlook.MailItem

Set OL_Msg = OL_App.CreateItem(olMailItem)
With OL_Msg
CC = Split(destinataire, ";")
For I = LBound(CC) To UBound(CC)
Set OL_Recipient = .Recipients.Add(CC(I))
OL_Recipient.Type = olTo
Next I
If Not IsMissing(CopieCC) Then
CC = Split(CopieCC, ";")
For I = LBound(CC) To UBound(CC)
If CC(I) <> "" Then
Set OL_Recipient = .Recipients.Add(CC(I))
OL_Recipient.Type = olCC
End If
Next I
End If
.Subject = Sujet
.Body = Corps
.Importance = olImportanceHigh
If Not IsMissing(PièceJointe) Then
CC = Split(PièceJointe, ";")
For I = LBound(CC) To UBound(CC)
If CC(I) <> "" Then
Set OL_Attach = .Attachments.Add(CC(I))
End If
Next I
End If
For Each OL_Recipient In .Recipients
OL_Recipient.Resolve
If Not OL_Recipient.Resolve Then
OL_Msg.Display
Else
.Display ' choisir display ou send
' .Send
End If
Next
End With
OL_Msg.Send
Set OL_Msg = Nothing
Set OL_App = Nothing
Set OL_Attach = Nothing
Set OL_Recipient = Nothing
End Sub

Merci de vos aides.







Avatar
JièL Goubert
Bonjoir© AA

Le 01/02/2006 10:56 vous avez écrit... :
Je te remercie pour ta reponse,
Mais j'ai problème de selection de logiciel.


???

Se code me prend outlook express au lieu de Microsoft outlook 2003.


Nan, ce code ne prend ni l'un ni l'autre, il utilise CDO

Merci de bien vouloire M'aider.


Je ne suis pas l'auteur de ce code, voyez sur le forum Access.

--
JièL / Jean-Louis GOUBERT
La FAQ Outlook est la : http://faq.outlook.free.fr