Bonjour à tous!

Je suis tout nouveau et débutant à utiliser VBA à partir d'une base de données excel..J`espere que quelqu'un peut m`aider dans ce vrai challenge!

En fait, j`utilise un code pour envoyer des communications massives à tous mes fournisseurs et clients (mail auto généré à partir d'une base de données excel via client lotus notes). Dans ces mails, il faudrait que j`affiche un tableau différent pour chaque contact (imaginons que pour le fournisseur info@pomme.fr contenu en F1, je dois lui envoyer un petit tableau horizontal de range A1:E1). Il faudrait que le tableau sois une vrai table (et pas de cellules séparées par un simple charactere│ ou - ..)\

Je sais qu'il y a un moyen mais malheureusement mes connaissances de base de vba ne me permettent pas de continuer tout seul!

Merci de vos idées et suggestions,

meilleurs salutations,

Ale

voici le code:

Private Sub CommandButton1_Click()

For x = 1 To 10
r = Cells(x, 31)

L = " Dear customer," & vbCrLf & vbCrLf & "Hello! Please find your accounts details below" ici je devrais mettre le tableau, range A1:E1 & vbCrLf & vbCrLf & "Best regards," & vbCrLf & vbCrLf

Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant, vaMsg As Variant

Const EMBED_ATTACHMENT As Long = 1454

'Retrieve the path and filename of the file to be attached.
stAttachment = "P:\..."

'Initiate the Lotus Notes COM's Objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")

'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL

'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set obAttachment = noDocument.CreateRichTextItem("stAttachment")
Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, "", stAttachment)

'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.SendTo = r
.Subject = " Massive contracts "
.body = L
.SaveMessageOnSend = True

End With

'Send the e-mail.
With noDocument
.PostedDate = Now()
.send 0, vaRecipient
End With

'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing

Next

'Activate Excel for the user.
AppActivate "Microsoft Excel"
MsgBox "The e-mail has successfully been created and distributed.", vbInformation

End Sub