hi,
I am searching vba to read a html file into the body of a mail plus the attach of a file …
I have some code for the html file but i don’t know how to attach a file in this example :
my vba:
Function SendMailHtml(Destinataire As String, Sujet As String, Texte As String, LinkFile As String)
On Error GoTo TraiteErr
Dim objNotes As Object
Dim objNotesDB As Object
Dim objNotesMailDoc As Object
Dim objLink As Object
Dim FileToAttach As Object
Dim maildbname As String
Dim username As String
Dim mywkspace As Object
Dim suser As String
Dim sserver As String
Dim smailfile As String
Dim mydoc As Object
Dim AttachME As Object
Dim EmbedObj As Object
'Dim NotesRTF As Object
Set objNotes = GetObject("", "Notes.NotesSession")
'username = objNotes.username
'maildbname = Left(username, 1) & Right(username, (Len(username) - InStr(1, username, " "))) & ".nsf"
suser = objNotes.username
sserver = objNotes.GetEnvironmentString("MailServer", True)
smailfile = objNotes.GetEnvironmentString("MailFile", True)
Set mywkspace = CreateObject("notes.NOTESUIWORKSPACE")
Set mydoc = mywkspace.COMPOSEDOCUMENT(sserver, smailfile, "Memo", 1, 1)
Call mydoc.GOTOFIELD("Subject")
Call mydoc.InsertText(Sujet)
Call mydoc.GOTOFIELD("EnterSendTo")
Call mydoc.InsertText(Destinataire)
Call mydoc.GOTOFIELD(“Body”)
Call mydoc.Import(“html”, “Y:\U64501\access\DRHEvaluation\test.html”)
'ici les parametres pour envoi, enregistre, fermeture
Call mydoc.Send
Call mydoc.Close
If Len(LinkFile) <> 0 Then
???
End If
FinProcedure:
Exit Function
TraiteErr:
Select Case Err.Number
Case 91
MsgBox "Il semble que Notes soit occupé, il n'est pas possible de créer le message" & vbCrLf & vbCrLf & _
"Veuillez libérer Lotus Notes, puis relancer la procédure" _
, vbCritical, "Erreur de communication avec Lotus Notes"
'MsgBox "la commande à supprimer est la:" & LaCommande2
'SupCommande LaCommande2
Err.Clear
Exit Function
Case Else
MsgBox "Erreur N°:" & Err.Number & vbCrLf & _
"Description:" & Err.Description
Resume Next
End Select
End Function
hanks for your support