That's what I use. It saves my reports to specific folder and creates new folder if it doesn't exist.
Code:
Sub SendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim mystr As String
Dim myCurrentDir As String
myCurrentDir = CurrentProject.Path & "\" 'Directory of current database
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = Nz(<your email field here>, "")
.Subject = "Subject"
.BodyFormat = olFormatHTML
mystr = "HTML formatted body message"
.HTMLBody = mystr
If Not IsMissing(AttachmentPath) Then 'Add attatchment
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
.Display 'Display the whole thing in Outlook
End With
Set objOutlook = Nothing
End Sub
Now button to call the send function
Code:
Private Sub cmdEmail_Click()
If Not IsNull(<your email field here>) Then
Dim myCurrentDir As String
Dim myInvoiceDir As String
Dim myInvoiceOutput As String
myCurrentDir = CurrentProject.Path & "\"
myInvoiceDir = myCurrentDir & "<your desired directory>" & "\" & "<your desired sub directory>" & "\"
myInvoiceOutput = myInvoiceDir & <name of your report> & ".pdf"
If Len(Dir(myInvoiceDir, vbDirectory)) = 0 Then
MkDir myInvoiceDir
Else
DoCmd.OutputTo acOutputReport, <your report name here>, acFormatPDF, myInvoiceOutput, , , , acExportQualityPrint
SendMessage, myInvoiceOutput 'Call the SendMessage function with attatchment path
End If
Else
MsgBox ("No E-mail address available for this client")
End If
End Sub