CycloneBill
New Member
- Joined
- Aug 28, 2013
- Messages
- 2
Good Morning All,
I am attempting to make a macro that will create a pdf, then attach it to Outlook email. I have succeeded in getting it to, create, address correctly but not attach the pdf. Below is my script:
Dim SheetName As String
SheetName = ActiveSheet.Name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"T:\Accounting\MAsters and Projections\Payroll master schedules\Outbound Masters\" & ActiveSheet.Name, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
With OutMail
.To = Workbooks("UploadMacro.xlsm").Worksheets("Ref").Range("F3")
.CC = Workbooks("UploadMacro.xlsm").Worksheets("Ref").Range("F2")
.BCC = ""
.Subject = ActiveSheet.Name
.Body = ""
.Attachments.Add ActiveWorkSheet.FullName <---- This is where I am hitting a wall
.Display
End With
End With
End Sub
Advise? Thanks in advance!
I am attempting to make a macro that will create a pdf, then attach it to Outlook email. I have succeeded in getting it to, create, address correctly but not attach the pdf. Below is my script:
Dim SheetName As String
SheetName = ActiveSheet.Name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"T:\Accounting\MAsters and Projections\Payroll master schedules\Outbound Masters\" & ActiveSheet.Name, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
With OutMail
.To = Workbooks("UploadMacro.xlsm").Worksheets("Ref").Range("F3")
.CC = Workbooks("UploadMacro.xlsm").Worksheets("Ref").Range("F2")
.BCC = ""
.Subject = ActiveSheet.Name
.Body = ""
.Attachments.Add ActiveWorkSheet.FullName <---- This is where I am hitting a wall
.Display
End With
End With
End Sub
Advise? Thanks in advance!