E-mail Access Reports
Allows you to use Outlook to send bulk e-mails of Access Reports in Snapshot Format to users (ISO Printing, Faxing etc...)
AI
Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kod źródłowy
'Option Explicit
Public Sub MailToUsers()
Dim myOlApp As Application
Dim myItem As MailItem
Dim Path As String
Dim myAttachments As Attachments
Dim db As Database
Dim rs As Recordset
Dim BodyMsg As String
On Error GoTo myErr
'Set Database and Path to use to use
Set db = OpenDatabase("z:\DatabasePath\dbDatabaseName.mdb")
'Set Path to where Files are located
Path = "z:\SnapshotFilesPath\"
'Set Value for Body Message
BodyMsg = "Type whatever bodymessage you might need"
'Set Recordset to Users Table
Set rs = db.OpenRecordset("tblUsers")
'Open or use Outlook
Set myOlApp = CreateObject("Outlook.Application")
rs.MoveLast
rs.MoveFirst
Do Until rs.EOF
'Creates a new Outlook MailItem
Set myItem = myOlApp.CreateItem(olMailItem)
With myItem
.To = rs.Fields("[Email]")
.Subject = "Supply your subject line here"
.Body = BodyMsg
End With
'This Creates an Outlook attachment
Set myAttachments = myItem.Attachments
With myAttachments
'Do for all reports
.Add Path & "\rptReport1.snp"
.Add Path & "\rptReport2.snp"
'************************************
'Additional Documents can be added
'Supply full Path and File Name
'.Add "c:\moc\Questionnaire Script Changes for Dealer Reports 2000_03.doc"
'************************************
'Use myItem.Save ISO myItem.Send to view before sending
'myItem.Save
myItem.Send
End With
'Go to the next user
rs.MoveNext
Loop
Set myOlApp = Nothing
Set rs = Nothing
Set db = Nothing
Exit Sub
myErr:
Resume Next
End Sub
Oryginalne komentarze (3)
Odzyskane z Wayback Machine