? |
Public Sub SendEmailAtt(ByVal MyTo As String, MySybject As String, _ Optional MyBody As String, Optional MyAttachment As String, _ Optional MyAttachment2 As String, Optional NoWait As Boolean, Optional FromNameEmail As String) Dim OutLookApp As Object ' MS Outlook Dim OutLookItem As Object ' Dim OlNotRunning As Boolean ' MS Outlook Dim AdobeApp As Object Dim myNameSpace As Object On Error Resume Next ' MS Outlook Set OutLookApp = GetObject(, "Outlook.Application") If Err.Number <> 0 Then ' OlNotRunning = True Err.Clear Set OutLookApp = CreateObject("Outlook.Application") End If ' Set OutLookItem = OutLookApp.CreateItem(0) OutLookItem.To = MyTo ' OutLookItem.Subject = MySybject ' OutLookItem.Body = MyBody ' OutLookItem.Attachments.Add MyAttachment '1 OutLookItem.Attachments.Add MyAttachment2 '2 If Nz(FromNameEmail, "") <> "" Then OutLookItem.SentOnBehalfOfName = FromNameEmail End If OutLookItem.Display ' ' OutLook If OlNotRunning = True Then OutLookApp.Application.Quit If NoWait = True Then OutLookItem.send End Sub
http://www.sql.ru/forum/1226920/kak-otpravit-pochtu-gruppe-polzovateley