This function exports an Access report to a *.snp (snapshot)
and emails to all addies in the RECIPIENTS table
Function MailDaily()
Dim dbsThis As Database
Dim rstSel As Recordset
Dim rstRec As Recordset
Dim olApp As Outlook.Application
Dim olNameSpace As NameSpace
Dim olFolder
Dim olMail As MailItem
Set dbsThis = CurrentDb
Set rstRec = dbsThis.OpenRecordset("RECIPIENT"
'create a mail piece
Set olApp = CreateObject("Outlook.Application"
Set olNameSpace = olApp.GetNamespace("MAPI"
olNameSpace.Session.Logon "profilename", "password"
Set olFolder = olNameSpace.GetDefaultFolder(olFolderOutbox)
Set olMail = olFolder.Items.Add("IPM.Message"
olMail.Subject = "Network Volume Utilization " & DATE - 1
olMail.Attachments.Add "C:\DAILY VOLUME UTL.SNP"
With rstRec
Do Until .EOF
olMail.Recipients.Add .Fields(0)
.MoveNext
Loop
End With
olMail.Recipients.ResolveAll
olMail.Send
'EOJ:
olApp.Session.Logoff
olApp.Quit
Set olApp = Nothing
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.