Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Envoye de mail

5 réponses
Avatar
Anaïs
Bonjour,

Je voudrai vous solliciter encore une fois,

Je dispose de 3 fichiers Excel : France, Spain, UK

Un autre fichier construit comme suit :

Colonne A, Colonne B
France , Anais@anais.com
Spain , spain@spain.com


Je voudrais envoyer automatiquement le fichier France à l’adresse
Anais@anais.com et le fichier Spain à l’adresse spain@spain.com
Est’ il possible de lier les fichiers entre eux. Ils ont un point commun :
le nom du pays

Précision j’utilise Lotus et non outlook.

Merci de votre aide. (à chaque fois vous me donner des conseils très utiles,
je vous remercie encore).

Anais

5 réponses

Avatar
Poulpor
Bonjour Anais,

Voici un morceau de code de base d'envoi d'email par Lotus, ce qui devrait
t'aider :

Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GETDATABASE("", "")
Call oDB.OPENMAIL
flag = True
If Not (oDB.IsOpen) Then flag = oDB.Open("", "")

If Not flag Then
MsgBox "Ne peut pas ouvrir le fichier : " & oDB.SERVER &
" " & oDB.FilePath
GoTo exit_SendAttachment
End If

'On Error GoTo err_handler:


Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.Subject = "MySujet"
oDoc.sendto = ""
oDoc.CopyTo = ""
oDoc.body = "test"
oDoc.postdate = Date

'Attache piece jointe
FileSaveName="C:toto.xls"
Call oItem.EmbedObject(1454, "", FileSaveName)
oDoc.visable = True

'Envoie le message

oDoc.SEND False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing


Avec cela, ca devrait etre plus facile. Je ne peux effectuer de test, ayant
désormais MS Outlook.

Attention, je me souviens qu'à la moindre erreur (Lotus non ouvert ou non
dispo), je n'ai aucun retour de lotus ou d'excel.
Et si mes souvenirs sont bons, il ne range pas l'email dans les emails
envoyés => il faut donc te mettre en copie si tu veux conserver une trace


Bon courage,

Poulpor


Bonjour,

Je voudrai vous solliciter encore une fois,

Je dispose de 3 fichiers Excel : France, Spain, UK

Un autre fichier construit comme suit :

Colonne A, Colonne B
France ,
Spain ,


Je voudrais envoyer automatiquement le fichier France à l’adresse
et le fichier Spain à l’adresse
Est’ il possible de lier les fichiers entre eux. Ils ont un point commun :
le nom du pays

Précision j’utilise Lotus et non outlook.

Merci de votre aide. (à chaque fois vous me donner des conseils très utiles,
je vous remercie encore).

Anais


Avatar
Daniel
Bonjour.
Essaie le code suivant (emprunté pour le gros oeuvre à un contributeur du
net) :
Tu dois modifier l'emplacement de tes fichiers.

Sub Envoi()
Dim Sujet As String, Corps As String, Desti As String
Dim CC As String, c As Range, PJ As String
Dim Tablo(1, 1)
Tablo(0, 0) = ""
Tablo(0, 1) = "c:tempFrance.xls"
Tablo(1, 0) = ""
Tablo(1, 1) = "c:tempspain.xls"
Sujet = "Sujet du message"
Corps = "Corps du message"
CC = ""
For i = 0 To 1
Desti = Tablo(i, 0)
PJ = Tablo(i, 1)
SendNotesMail Sujet, Corps, Desti, CC, PJ
Next i
End Sub
Public Sub SendNotesMail(Sujet, Corps, Desti, CC, PJ)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim Corps_Msg As String ' text du courriel
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
' Session.Initialize ("password" )
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other
mailboxes.
''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) -
InStr(1, UserName, " "))) & ".nsf"
''UserName = Session.UserName

''SearchString = Recipient
''SearchChar = "@"
''MyPos = InStr(1, SearchString, SearchChar, vbTextCompare)
''Destinataire = Left(SearchString, MyPos - 1)
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", "")
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Desti
MailDoc.Subject = Sujet
MailDoc.copyto = CC
'MailDoc.Body = Corps
Set MailCorps = MailDoc.CREATERICHTEXTITEM("Body")

With MailCorps
.ADDNEWLINE 1
.APPENDTEXT Corps
.ADDNEWLINE 2
End With

MailDoc.SAVEMESSAGEONSEND = True
'Set up the embedded object and attachment and attach it
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
'AttachME.AppendText "toto"
Call AttachME.EMBEDOBJECT(1454, "", PJ, "Attachment")

'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items
folder
MailDoc.Send 0
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

End Sub

Cordialement.
Daniel
"Poulpor" a écrit dans le message de
news:
Bonjour Anais,

Voici un morceau de code de base d'envoi d'email par Lotus, ce qui devrait
t'aider :

Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GETDATABASE("", "")
Call oDB.OPENMAIL
flag = True
If Not (oDB.IsOpen) Then flag = oDB.Open("", "")

If Not flag Then
MsgBox "Ne peut pas ouvrir le fichier : " & oDB.SERVER
&
" " & oDB.FilePath
GoTo exit_SendAttachment
End If

'On Error GoTo err_handler:


Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.Subject = "MySujet"
oDoc.sendto = ""
oDoc.CopyTo = ""
oDoc.body = "test"
oDoc.postdate = Date

'Attache piece jointe
FileSaveName="C:toto.xls"
Call oItem.EmbedObject(1454, "", FileSaveName)
oDoc.visable = True

'Envoie le message

oDoc.SEND False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing


Avec cela, ca devrait etre plus facile. Je ne peux effectuer de test,
ayant
désormais MS Outlook.

Attention, je me souviens qu'à la moindre erreur (Lotus non ouvert ou non
dispo), je n'ai aucun retour de lotus ou d'excel.
Et si mes souvenirs sont bons, il ne range pas l'email dans les emails
envoyés => il faut donc te mettre en copie si tu veux conserver une trace


Bon courage,

Poulpor


Bonjour,

Je voudrai vous solliciter encore une fois,

Je dispose de 3 fichiers Excel : France, Spain, UK

Un autre fichier construit comme suit :

Colonne A, Colonne B
France ,
Spain ,


Je voudrais envoyer automatiquement le fichier France à l'adresse
et le fichier Spain à l'adresse
Est' il possible de lier les fichiers entre eux. Ils ont un point commun
:
le nom du pays

Précision j'utilise Lotus et non outlook.

Merci de votre aide. (à chaque fois vous me donner des conseils très
utiles,
je vous remercie encore).

Anais




Avatar
Daniel
Oups. Posté de travers.
Daniel
"Daniel" a écrit dans le message de news:

Bonjour.
Essaie le code suivant (emprunté pour le gros oeuvre à un contributeur du
net) :
Tu dois modifier l'emplacement de tes fichiers.

Sub Envoi()
Dim Sujet As String, Corps As String, Desti As String
Dim CC As String, c As Range, PJ As String
Dim Tablo(1, 1)
Tablo(0, 0) = ""
Tablo(0, 1) = "c:tempFrance.xls"
Tablo(1, 0) = ""
Tablo(1, 1) = "c:tempspain.xls"
Sujet = "Sujet du message"
Corps = "Corps du message"
CC = ""
For i = 0 To 1
Desti = Tablo(i, 0)
PJ = Tablo(i, 1)
SendNotesMail Sujet, Corps, Desti, CC, PJ
Next i
End Sub
Public Sub SendNotesMail(Sujet, Corps, Desti, CC, PJ)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim Corps_Msg As String ' text du courriel
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
' Session.Initialize ("password" )
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other
mailboxes.
''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) -
InStr(1, UserName, " "))) & ".nsf"
''UserName = Session.UserName

''SearchString = Recipient
''SearchChar = "@"
''MyPos = InStr(1, SearchString, SearchChar, vbTextCompare)
''Destinataire = Left(SearchString, MyPos - 1)
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", "")
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Desti
MailDoc.Subject = Sujet
MailDoc.copyto = CC
'MailDoc.Body = Corps
Set MailCorps = MailDoc.CREATERICHTEXTITEM("Body")

With MailCorps
.ADDNEWLINE 1
.APPENDTEXT Corps
.ADDNEWLINE 2
End With

MailDoc.SAVEMESSAGEONSEND = True
'Set up the embedded object and attachment and attach it
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
'AttachME.AppendText "toto"
Call AttachME.EMBEDOBJECT(1454, "", PJ, "Attachment")

'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items
folder
MailDoc.Send 0
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

End Sub

Cordialement.
Daniel
"Poulpor" a écrit dans le message de
news:
Bonjour Anais,

Voici un morceau de code de base d'envoi d'email par Lotus, ce qui
devrait
t'aider :

Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GETDATABASE("", "")
Call oDB.OPENMAIL
flag = True
If Not (oDB.IsOpen) Then flag = oDB.Open("", "")

If Not flag Then
MsgBox "Ne peut pas ouvrir le fichier : " & oDB.SERVER
&
" " & oDB.FilePath
GoTo exit_SendAttachment
End If

'On Error GoTo err_handler:


Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.Subject = "MySujet"
oDoc.sendto = ""
oDoc.CopyTo = ""
oDoc.body = "test"
oDoc.postdate = Date

'Attache piece jointe
FileSaveName="C:toto.xls"
Call oItem.EmbedObject(1454, "", FileSaveName)
oDoc.visable = True

'Envoie le message

oDoc.SEND False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing


Avec cela, ca devrait etre plus facile. Je ne peux effectuer de test,
ayant
désormais MS Outlook.

Attention, je me souviens qu'à la moindre erreur (Lotus non ouvert ou non
dispo), je n'ai aucun retour de lotus ou d'excel.
Et si mes souvenirs sont bons, il ne range pas l'email dans les emails
envoyés => il faut donc te mettre en copie si tu veux conserver une trace


Bon courage,

Poulpor


Bonjour,

Je voudrai vous solliciter encore une fois,

Je dispose de 3 fichiers Excel : France, Spain, UK

Un autre fichier construit comme suit :

Colonne A, Colonne B
France ,
Spain ,


Je voudrais envoyer automatiquement le fichier France à l'adresse
et le fichier Spain à l'adresse
Est' il possible de lier les fichiers entre eux. Ils ont un point commun
:
le nom du pays

Précision j'utilise Lotus et non outlook.

Merci de votre aide. (à chaque fois vous me donner des conseils très
utiles,
je vous remercie encore).

Anais








Avatar
Daniel
Bonjour.
Essaie le code suivant (emprunté pour le gros oeuvre à un contributeur du
net) :
Tu dois modifier l'emplacement de tes fichiers.

Sub Envoi()
Dim Sujet As String, Corps As String, Desti As String
Dim CC As String, c As Range, PJ As String
Dim Tablo(1, 1)
Tablo(0, 0) = ""
Tablo(0, 1) = "c:tempFrance.xls"
Tablo(1, 0) = ""
Tablo(1, 1) = "c:tempspain.xls"
Sujet = "Sujet du message"
Corps = "Corps du message"
CC = ""
For i = 0 To 1
Desti = Tablo(i, 0)
PJ = Tablo(i, 1)
SendNotesMail Sujet, Corps, Desti, CC, PJ
Next i
End Sub
Public Sub SendNotesMail(Sujet, Corps, Desti, CC, PJ)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim Corps_Msg As String ' text du courriel
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
' Session.Initialize ("password" )
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other
mailboxes.
''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) -
InStr(1, UserName, " "))) & ".nsf"
''UserName = Session.UserName

''SearchString = Recipient
''SearchChar = "@"
''MyPos = InStr(1, SearchString, SearchChar, vbTextCompare)
''Destinataire = Left(SearchString, MyPos - 1)
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", "")
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Desti
MailDoc.Subject = Sujet
MailDoc.copyto = CC
'MailDoc.Body = Corps
Set MailCorps = MailDoc.CREATERICHTEXTITEM("Body")

With MailCorps
.ADDNEWLINE 1
.APPENDTEXT Corps
.ADDNEWLINE 2
End With

MailDoc.SAVEMESSAGEONSEND = True
'Set up the embedded object and attachment and attach it
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
'AttachME.AppendText "toto"
Call AttachME.EMBEDOBJECT(1454, "", PJ, "Attachment")

'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items
folder
MailDoc.Send 0
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

End Sub

Cordialement.
Daniel

"Anaïs" a écrit dans le message de news:

Bonjour,

Je voudrai vous solliciter encore une fois,

Je dispose de 3 fichiers Excel : France, Spain, UK

Un autre fichier construit comme suit :

Colonne A, Colonne B
France ,
Spain ,


Je voudrais envoyer automatiquement le fichier France à l'adresse
et le fichier Spain à l'adresse
Est' il possible de lier les fichiers entre eux. Ils ont un point commun :
le nom du pays

Précision j'utilise Lotus et non outlook.

Merci de votre aide. (à chaque fois vous me donner des conseils très
utiles,
je vous remercie encore).

Anais


Avatar
Anaïs
Juste un mot : MERCI

merci pour votre aide si précieuse..
anais



Bonjour.
Essaie le code suivant (emprunté pour le gros oeuvre à un contributeur du
net) :
Tu dois modifier l'emplacement de tes fichiers.

Sub Envoi()
Dim Sujet As String, Corps As String, Desti As String
Dim CC As String, c As Range, PJ As String
Dim Tablo(1, 1)
Tablo(0, 0) = ""
Tablo(0, 1) = "c:tempFrance.xls"
Tablo(1, 0) = ""
Tablo(1, 1) = "c:tempspain.xls"
Sujet = "Sujet du message"
Corps = "Corps du message"
CC = ""
For i = 0 To 1
Desti = Tablo(i, 0)
PJ = Tablo(i, 1)
SendNotesMail Sujet, Corps, Desti, CC, PJ
Next i
End Sub
Public Sub SendNotesMail(Sujet, Corps, Desti, CC, PJ)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim Corps_Msg As String ' text du courriel
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
' Session.Initialize ("password" )
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other
mailboxes.
''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) -
InStr(1, UserName, " "))) & ".nsf"
''UserName = Session.UserName

''SearchString = Recipient
''SearchChar = "@"
''MyPos = InStr(1, SearchString, SearchChar, vbTextCompare)
''Destinataire = Left(SearchString, MyPos - 1)
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", "")
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Desti
MailDoc.Subject = Sujet
MailDoc.copyto = CC
'MailDoc.Body = Corps
Set MailCorps = MailDoc.CREATERICHTEXTITEM("Body")

With MailCorps
.ADDNEWLINE 1
.APPENDTEXT Corps
.ADDNEWLINE 2
End With

MailDoc.SAVEMESSAGEONSEND = True
'Set up the embedded object and attachment and attach it
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
'AttachME.AppendText "toto"
Call AttachME.EMBEDOBJECT(1454, "", PJ, "Attachment")

'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items
folder
MailDoc.Send 0
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

End Sub

Cordialement.
Daniel

"Anaïs" a écrit dans le message de news:

Bonjour,

Je voudrai vous solliciter encore une fois,

Je dispose de 3 fichiers Excel : France, Spain, UK

Un autre fichier construit comme suit :

Colonne A, Colonne B
France ,
Spain ,


Je voudrais envoyer automatiquement le fichier France à l'adresse
et le fichier Spain à l'adresse
Est' il possible de lier les fichiers entre eux. Ils ont un point commun :
le nom du pays

Précision j'utilise Lotus et non outlook.

Merci de votre aide. (à chaque fois vous me donner des conseils très
utiles,
je vous remercie encore).

Anais