Results 1 to 2 of 2

VBA to send multiple emails whilst filtering pivot table

Threaded View

ChipsSlave VBA to send multiple emails... 05-19-2017, 04:54 AM
ChipsSlave Re: VBA to send multiple... 05-19-2017, 06:04 AM
  1. #1
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    VBA to send multiple emails whilst filtering pivot table

    Hello all,

    I have previously posted a thread about using a loop to send emails to different names which data is stored in different sheets. Here is the link. But now I have got to many names and creating different sheets for each of them names is out of the question. I was wondering would it be possible to send different emails with matching data from pivot table? This is the code I'm using right now:

    Sub Send_Range_Or_Whole_Worksheet_with_MailEnvelope()
        sn = Sheets("Contacts").Cells(1).CurrentRegion.Value
        With Application
            .ScreenUpdating = False
            .EnableEvents = False
        End With
        For i = 2 To UBound(sn)
            ActiveWorkbook.EnvelopeVisible = True
            Set Sendrng = Sheets(sn(i, 1)).Range("A1:M71")
            With Sendrng
                .Parent.Select
                With .Parent.MailEnvelope
                    .Introduction = sn(i, 4)
                    With .Item
                        .To = sn(i, 2)
                        .Subject = sn(i, 3)
                        .Send
                    End With
                End With
            End With
        Next
        ActiveWorkbook.EnvelopeVisible = False
        With Application
            .Goto Sheets("Contacts").Range("A1")
            .ScreenUpdating = False
            .EnableEvents = False
        End With
    End Sub
    Would it be possible to incorporate the below code into the code above so the pivot table would be filtered accordingly to contacts table?

        ActiveSheet.PivotTables("PivotTable1").PivotFields("Name").ClearAllFilters
        ActiveSheet.PivotTables("PivotTable1").PivotFields("Name").CurrentPage = "AMKL"
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to send emails with different attachments and table in the email.
    By aashish.shetty in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2022, 05:36 AM
  2. VBA to send multiple emails whilst filtering pivot slicer
    By ChipsSlave in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2017, 02:07 PM
  3. [SOLVED] VBA to send multiple emails
    By ChipsSlave in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-20-2016, 01:35 PM
  4. [SOLVED] Send multiple emails with one attachment each
    By unix17 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2016, 08:02 PM
  5. [SOLVED] Macro To Send Emails with PDF: Multiple Emails and PDF's
    By totoga12 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-19-2014, 06:13 PM
  6. VBA to send multiple emails with different attachments
    By gillyr7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2014, 02:33 PM
  7. Send emails to multiple addresses
    By jenksie101 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-02-2010, 09:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1