VBA Access - Distributing Access reports using email

Sub RunEmailDist()
       Dim MyDB As Database, MyRecs As Recordset, MyName As String
       Set MyDB = CurrentDb()
       Set MyRecs = MyDB.OpenRecordset("emaildist")

       Let MyName = InputBox("Entre o seu nome","RunEmailDist (CiM)", "Chris Mead (Extn 3841)")

       MyRecs.MoveFirst
       Do While Not MyRecs.EOF

       If MyRecs!distname = Forms("F_ChooseEmail")!DistNameCombo Then
              DoCmd.SendObject acSendReport, "Your budget report", acFormatRTF, MyRecs!SendTo, , , "Budget reports", _
"Please find attached your set of budget reports." & vbCrLF & MyName, 0
       End If

       MyRecs.MoveNext
       Loop

       MyRecs.Close
End Sub


André Luiz Bernardes
A&A - WORK, DON´T PLAY!
http://al-bernardes.sites.uol.com.br/
bernardess@gmail.com

Nenhum comentário:

Postar um comentário

diHITT - Notícias