1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| Sub Enregistrer_sur_votre_desktop_service_toto()
Dim strDate As String
strDate = Format(Now, " dd-mmm-yyyy-hh-mm")
ActiveWorkbook.SaveAs "C:\Users\toto\Documents\Demande_Prix_Toto " & Format(Now, " dd.mm.yyyy, hh""h""mm") & ".xls"
End Sub
Sub Envoyer_par_mail_service_toto()
Dim Session As Object
Dim Dir As Object
Dim Doc As Object
Dim Workspace As Object
Dim EditDoc As Object
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim ATTACHMENT
On Error GoTo TraiteErreur
'Création de la session Notes
Set Workspace = CreateObject("Notes.NotesUIWorkspace")
Set Session = CreateObject("notes.NOTESSESSION")
Set Dir = Session.GetDatabase("", "")
Call Dir.OPENMAIL
'Creation d'un document
Set Doc = Dir.CreateDocument
Doc.Form = "Memo"
Doc.Subject = "URGENT: Demande de Prix pour un Toto"
Doc.SendTo = "toto@toto.com"
Doc.copyto = "toto2@toto.com"
Doc.body = "Bonjour, Merci de prendre toto aussi tôt que possible."
'Set up the embedded object and attachment and attach it
If ATTACHMENT <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", ATTACHEMENTS, "Attachment")
MailDoc.CREATERICHTEXTITEM ("Attachment")
End If
'Affichage du mail dans Lotus Notes
Set EditDoc = Workspace.EditDocument(True, Doc)
Set Session = Nothing
Set Dir = Nothing
Set Doc = Nothing
Set Workspace = Nothing
Set EditDoc = Nothing
Exit Sub
TraiteErreur:
MsgBox "Problème de création du mail", vbCritical, "Error"
Set Session = Nothing
Set Dir = Nothing
Set Doc = Nothing
Set Workspace = Nothing
Set EditDoc = Nothing |
Partager