Hi,
I have the below code that will convert my active sheet to a .pdf file to be emailed. However, I am looking for code that will attach the active xlsx or xlsm sheet to an email.
I have the below code that will convert my active sheet to a .pdf file to be emailed. However, I am looking for code that will attach the active xlsx or xlsm sheet to an email.
Code:
Sub CreateEmail()
Dim olMail As Object
Dim ws As Worksheet
Dim fName As String
Dim olApp As Object
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.createItem(0)
Set ws = ActiveSheet
fName = Environ("UserProfile") & "\Desktop\” & Range(“L10”).Value & “.pdf"
ws.ExportAsFixedFormat xlTypePDF, fName, xlQualityStandard
With olMail
.To = ""
.Subject = "Range(“L10”)"
.Body = ""
.Attachments.Add fName
.Display 'You can change to .Send to send email instead of displaying it
End With
Kill fName
End Sub
[\code]
I appreciate the help.
Thanks,
Brian