Ajouter un commentaire

skaiffer

C'est un peu tard, mmais peut-être cela servira à d'autres

je connais 2 methodes :
- le driver ODBC NotesSQL qui permet d'effectuer des requetes SQL et l'on peut simplement lier les tables dasn Access après avoir créer l'ebntrée odbc

- l'automation OLE, avec un client Notes lancé on peut le piloter par script.
ci-joint un exemple d'envoire de mail par Excel ou vbs (avev une piece jointe & une section notes).
On peut aussi extraire les données de la base, par cntre pourune base il faut connaitre la structure (les différentes champs). On peut l'obtenir avec un clik droit/propriétés sur un document et le 2eme onglet,(champs/fields)

Sub SendMail()
'Lotus Notes Definition
Dim Maildb As Object 'The mail database
Dim strUserName As String 'The current users notes name
Dim session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)

'End Lotus definition

Dim strSendTo As String
strSendTo = "destinataire"

pstrCopyTo = ""
pstrSubject = "Test envoie fichier"
pstrBody = "salut"
On Error GoTo EndToSend:

'Start a session to notes
Set session = CreateObject("Notes.NotesSession")
'Get Current user
strUserName = session.Username
'Open the mail database in notes
Set Maildb = session.GETDATABASE("MAILSERVER", "mail\Mail3\myuser.nsf")
If Maildb.IsOpen = False Then 'Not already open for mail
Maildb.OPENMAIL
End If

'Create new memo
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.SendTo = strSendTo
MailDoc.CopyTo = pstrCopyTo
MailDoc.Subject = pstrSubject
'*********************************************************************************

Call MiseEnPage(MailDoc, session)

'*********************************************************************************
MailDoc.SAVEMESSAGEONSEND = True
MailDoc.From = strUserName

'Send the memo
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 session = Nothing
Exit Sub
EndToSend:
Dim strMsg As String
Dim intStyle As Integer
Dim strTitle As String
Dim intResponse As Integer
'Error message
Debug.Print Err.Description
strMsg = "Une erreur est survenue lors de l'envoie du mail!!" ' Message.
intStyle = vbOKOnly ' Buttons.
strTitle = "Erreur d'envoie" ' Title.
intResponse = MsgBox(strMsg, intStyle, strTitle)
End Sub

Sub MiseEnPage(MailDoc, session)

Dim rtstyle: Set rtstyle = session.CREATERICHTEXTSTYLE
Dim rtstyle2: Set rtstyle2 = session.CREATERICHTEXTSTYLE
Dim colorObject: Set colorObject = session.CREATECOLOROBJECT
Dim body: Set body = MailDoc.CREATERICHTEXTITEM("Body")

rtstyle.Bold = True
rtstyle.NOTESFONT = 2
rtstyle.FontSize = 12
rtstyle2.NOTESFONT = 0
rtstyle2.NOTESCOLOR = 6
rtstyle2.FontSize = 16
colorObject.NOTESCOLOR = 12


Call body.APPENDSTYLE(rtstyle)
Call body.APPENDTEXT("Ligen dasn body.")

Call body.APPENDSTYLE(rtstyle2)
Call body.BEGINSECTION("Section name", rtstyle, colorObject)
Call body.APPENDTEXT("TEXTE ICI")
Call body.ADDNEWLINE(1)
Call body.ENDSECTION
Call body.APPENDTEXT("FIN de texte")
Call body.APPENDTEXT(Chr(13))
Call body.APPENDTEXT("FIN de texte2")

Set body = Nothing

End Sub

Filtered HTML

Plain text

CAPTCHA
Cette question permet de vérifier que vous n'êtes pas un robot spammeur :-)
 DDD   ZZZZZ  M   M   SSS   L    
D D Z MM MM S L
D D Z M M M SSS L
D D Z M M S L
DDD ZZZZZ M M SSSS LLLL