No it is not. I only posted where my issue was. I haven't had an issue generating the email and attaching the PDF but I cant seem to get the excel document to attach to the email as well.
Dim IsCreated As Boolean
Dim i As Long
Dim PdfFile As String, Title As String, Payee As String
Dim xlObj As Excel.Application
Dim wkbk As Object
Dim strUser As String
Dim strAttachment As String
Dim OutlApp As Object
Dim acOutputxl As Object
Dim DoCmd As Object
Dim acExportQualityPrint As Object
Title = Worksheets("ACH Transfers").Range("A1") & " - " & DateTime.Now
strUser = Environ("Username")
Title = Worksheets("ACH Transfers").Range("A1")
Payee = Worksheets("ACH Transfers").Range("A2")
Title = Title & " - " & Payee
PdfFile = ActiveWorkbook.FullName
i = InStrRev(PdfFile, ".")
If i > 1 Then PdfFile = Left(PdfFile, i - 1)
PdfFile = PdfFile & "_" & ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=True, OpenAfterPublish:=False
strAttachment = "C:\users" & strUser & "\desktop" & "ACH Transfers" & Format(Date, "mmddyy") & ".xlsx"
DoCmd.OutputTo acOutputxl, "ExcelWorkbook(*.xlsx)", strAttachment, False, "", , acExportQualityPrint
On Error Resume Next
Set OutlApp = GetObject(, "Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If
OutlApp.Visible = True
On Error GoTo 0
On Error Resume Next
Set xlObj = GetObject(, "Excel.Application")
If Err Then
Set xlObj = CreateObject("Excel.Application")
IsCreated = True
End If
xlObj.Visible = True
On Error GoTo 0
Set wkbk = xlObj.Workbooks.Open("C:\users" & strUser & "\desktop" & "ACH Transfers" & Format(Date, "mmddyy") & ".xlsx")
wkbk.Save
wkbk.Close
xlObj.Quit
Set xlObj = Nothing
With OutlApp.CreateItem(0)
.Subject = Title
.To = Worksheets("ACH Transfers").Range("J2")
.Body = "REQUESTOR tasks:" & vbLf _
& "1. Complete the Treasury Controllership Funding Request." & vbLf _
& "2. Email request to APPROVER to review." & vbLf _
& "3. NOTE: Do NOT email (To: or cc
to
IACTreasuryBanking@mmc.com. The APPROVER is the only person who should send an approval to this address." & vbLf & vbLf _
& "APPROVER tasks:" & vbLf _
& "1. Please review the attached file." & vbLf _
& "2. Forward your approval along with this form to
IACTreasuryBanking@mmc.com" & vbLf & vbLf _
& "NOTE: Any request without proper approval will not be processed." & vbLf
.Attachments.Add PdfFile
.Attachments.Add strAttachment
.Display
End With
Kill PdfFile
Kill strAttachment
If IsCreated Then OutlApp.Quit
Set OutlApp = Nothing
End Sub