Attached file.
after you step into the macros. once it filters invoices unpaid by the first customer, in the pivot.
It gives an error
I was not able to resolve this.
anyone able to help me run this code please.
Objective of this macro is automate: filter on pivot for each customer, that shows invoices unpaid. then email it to the customer..and so on for each customer
thanks ,
Does not work, it gives error when reaching line
ActiveWorkbook.EnvelopeVisible = True
" Method mail envelope of object _worksheet failed"
below is the code...
after you step into the macros. once it filters invoices unpaid by the first customer, in the pivot.
It gives an error
I was not able to resolve this.
anyone able to help me run this code please.
Objective of this macro is automate: filter on pivot for each customer, that shows invoices unpaid. then email it to the customer..and so on for each customer
thanks ,
Does not work, it gives error when reaching line
ActiveWorkbook.EnvelopeVisible = True
" Method mail envelope of object _worksheet failed"
below is the code...
Code:
Sub autoemail_customer()
Dim r As Range
Dim i As Integer
Set r = Sheets("Pivot").Cells
For i = 2 To 8
Sheets("Pivot").Range("B1").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Customer name"). _
ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Customer name"). _
CurrentPage = Sheets("Email Contact").Range("A" & i).Value
ActiveWorkbook.EnvelopeVisible = True
With r.Parent.MailEnvelope.Item
.To = Sheets("Email Contact").Range("b" & i).Value
.CC = ""
.Subject = Sheets("Email Contact").Range("a" & i).Value & "Customer invoices : Invoices Overdue"
.Body = "Below, list of invoices that are currently overdue and unpaid"
.send
End With
Next i
End Sub
Last edited by a moderator: