tableau vers lotus via mail

figoluce

XLDnaute Nouveau
Bonsoir,

voici se que je souhaite faire :
Envoi d'un mail à la comptabilité si le fax n'est pas envoyé 2 jours après la date de réception du colis.
Je souhaite également envoyé la ligne du tableau concernée dans le mail.

J'arrive à envoyer le mail basique :

Sub Mail_Range()
Dim Source As Range
Dim Dest As Workbook
Dim wb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim OutApp As Object
Dim OutMail As Object

'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 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")
'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
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
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 = "figoluce@toto.fr"
'MailDoc.CopyTo = "l'adresse de la personne en copie"
MailDoc.Subject = "Rappel FAX" '
' Construction du corps du message
Set objNotesField = MailDoc.CREATERICHTEXTITEM("Body")
With objNotesField
.AppendText "Please be advised that for the transfer below, the fax/email has not been sent yet"
.AddNewLine 2
.AppendText ""
.AddNewLine 2
.AppendText ""
.AddNewLine 1
.AppendText ""
.AddNewLine 3
End With


'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Recipient



'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

End Sub


- - - - - - - - -


Par contre je n'arrive pas à intégrer ce bout de code pour rajouter dans le mail un extrait du tableau :

Set Source = Nothing
On Error Resume Next
Set Source = Range("F56:K57").SpecialCells(xlCellTypeVisible)
On Error GoTo 0

If Source Is Nothing Then
MsgBox "The source is not a range or the sheet is protected, " & _
"please correct and try again.", vbOKOnly
Exit Sub
End If

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set wb = ActiveWorkbook
Set Dest = Workbooks.Add(xlWBATWorksheet)
Source.Copy
With Dest.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial Paste:=xlPasteValues
.Cells(1).PasteSpecial Paste:=xlPasteFormats
.Cells(1).Select
Application.CutCopyMode = False
End With

TempFilePath = Environ$("temp") & "\"
TempFileName = "Selection of " & wb.Name & " " _
& Format(Now, "dd-mmm-yy h-mm-ss")

If Val(Application.Version) < 12 Then
'You use Excel 2000-2003
FileExtStr = ".xls": FileFormatNum = -4143
End If


- - - - - - - -- - - - - -

Est-ce assez lisible ?
Merci d'avance
 

Discussions similaires

Réponses
2
Affichages
355
Réponses
6
Affichages
377
Réponses
2
Affichages
159

Statistiques des forums

Discussions
312 780
Messages
2 092 049
Membres
105 171
dernier inscrit
Laurent E