Soyez le premier à donner votre avis sur cette source.
Snippet vu 52 334 fois - Téléchargée 81 fois
Function CreateMail(astrRecip As Variant, _ strSubject As String, _ strMessage As String, _ Optional astrAttachments As Variant) As Boolean Dim olApp As Outlook.Application Dim objNewMail As Outlook.MailItem Dim varRecip As Variant Dim varAttach As Variant Dim blnResolveSuccess As Boolean On Error GoTo CreateMail_Err Set olApp = New Outlook.Application Set objNewMail = olApp.CreateItem(olMailItem) With objNewMail ' Add each item in the varRecip array to the Recipients collection. For Each varRecip In astrRecip .Recipients.Add varRecip Next varRecip ' Determine if all recipients have corresponding entries in the ' Outlook address book. blnResolveSuccess = .Recipients.ResolveAll ' Add each item in the varAttach array to the Attachments collection ' and specify the subject and text of the mail message. For Each varAttach In astrAttachments .Attachments.Add varAttach Next varAttach .Subject = strSubject .Body = strMessage ' If all recipients are valid then send the message now, otherwise ' display the message so the user can fix invalid e-mail addresses. If blnResolveSuccess Then .Send Else MsgBox "Unable to resolve all recipients. Please check " _ & "the names." .Display End If End With CreateMail = True CreateMail_End: Exit Function CreateMail_Err: CreateMail = False Resume CreateMail_End End Function
Pour éviter le message de sécurité Outlook, le seul moyen que j'ai trouvé est d'installer l'utilitaire suivant : ClickYes (http://www.contextmagic.com/downloads.htm) et le tour est joué.
Cordialement
http://www.vbfrance.com/code.aspx?ID=43130
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.