Bonjour,
voici un exemple pour préparer le courriel,
Sub SendRangeByMail()
Dim rngeSend As Range
With Application
On Error Resume Next
Set rngeSend = Sheets("Feuil1").Range(Range("A1").CurrentRegion.Address) 'à adapter
If rngeSend Is Nothing Then Exit Sub
sFile = Environ("Temp") & "\XLRange.htm"
On Error GoTo 0
.ActiveWorkbook.PublishObjects.Add(4, sFile, rngeSend.Parent.Name, rngeSend.Address, 0, "", "").Publish True
Call PrepareOutlookMail(sFile)
Kill sFile
End With
End Sub
Sub PrepareOutlookMail(sFileName)
Dim appOutlook As Outlook.Application
Dim oMail As Outlook.MailItem
Set appOutlook = CreateObject("Outlook.Application")
If Not (appOutlook Is Nothing) Then
Set oMail = appOutlook.CreateItem(olMailItem)
With oMail
.To = '"Adresse@mail.fr" 'à adapter
.Subject = "RELANCES A EFFECTUER"
.HTMLBody = ReadFile(sFileName)
.Display 'metre cette ligne en commentaire pour éviter l'affichage du mail
' .Send 'mettre cette ligne active pour l'envoi du mail sans qu'il soit affiché
End With
Set oMail = Nothing
Set appOutlook = Nothing
End If
End Sub
Public Function ReadFile(sFileName) As String
Dim fso As Object, fFile As Object
Dim sTemp As String
Set fso = CreateObject("Scripting.FileSystemObject")
Set fFile = fso.OpenTextFile(sFileName, 1, False)
sTemp = fFile.ReadAll
fFile.Close
Set fFile = Nothing
ReadFile = sTemp
End Function
pour la 2ème question: je ne connais pas Lotus