Hiya Peeps,
I wonder if someone can help me with this. I am trying to get the code to select the right data via autofilter, then email the sheet as a PDF.
I have the following code:
However I get the following error:
and this is the bit that is highlighted:
Cheers with the help in advance peeps :D
I wonder if someone can help me with this. I am trying to get the code to select the right data via autofilter, then email the sheet as a PDF.
I have the following code:
Code:
Sub Sort1()
'
ActiveSheet.Range("$AB$4:$AB$350").AutoFilter Field:=1, Criteria1:=Array( _
"Care Assistant", "RGN", "Senior Care ***..."), Operator:=xlFilterValues
ChDir "K:\Payroll\"
ActiveSheet.ExportAsFixedFormat Type:=x1TypePDF, Filename:= _
"K:\Payroll\testsave.pdf", OpenAfterPublish:=False
Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim myAttachments As Object
Set OutLookApp = CreateObject(“Outlook.application”)
Set OutLookMailItem = OutLookApp.CreateItem(0)
Set myAttachments = OutLookMailItem.Attachments
With OutLookMailItem
.To = “”
.Subject = "Time Sheets"
.Body = "Please check these and let me know if they are correct or not."
myAttachments.Add "K:\Payroll\testsave.pdf"
‘.send
.Display
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
However I get the following error:
Code:
Run-time error '424':
Object required
and this is the bit that is highlighted:
Code:
Set OutLookApp = CreateObject(“Outlook.application”)
Cheers with the help in advance peeps :D
Last edited: