Active Member
April 12, 2022
Hello,
I just read the article "Automating and Emailing Pivot Table Reports" and it worked perfectly.
However, I have two requirements:
1. I need to upload excel file instead of PDF.
2. I need the pivot and the data behind pivot data to be inserted. Data of pivot also need to be filtered and need to show only that filtered data.
I have dataset that only filtered "manager" need to see his own part.
Thanks a lot for this amazing website and all your help beforehand!
Regards
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
Hi Kemal,
You can attach any file you want to an email, that code works the same, just put the path to your xlsx instead of the pdf.
You cannot restrict the visible data for a specific person. Anyone can see all data, you have to send to that person only their subset of data.
Active Member
April 12, 2022
Hi Catalin,
I appreciate your respond. However, I get "file not found" error when I simply change extension to xlsx.
Regarding filtering data, I just want to filter data behind the pivot just as pivot, and copy visible cells to another sheet with that filtered pivot and send that sheet as an email. I believe this is possible.
Thank you!
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
You can't attach a file to an email without creating that file in that location, right?
Creating the pdf then attaching an xlsx (by simply changing the extension in the code) does not sound right.
Here is an example of a code that reads data from a table and creates a new file with data split into sheets:
https://www.myonlinetraininghu.....ist#p23558
This updated part of code will split data into different files:
If MasterDict.Count > 0 Then
Dim NewWb As Workbook
Dim NewSh As Worksheet, Rng As Range
For Each aKey In MasterDict.Keys
Counter = UBound(MasterDict(aKey), 2)
'add new book, sheet
Set NewWb = Workbooks.Add
Dim DestFolder As String: DestFolder = ThisWorkbook.Path & Application.PathSeparator & "Exports"
If Len(Dir$(DestFolder, vbDirectory)) = 0 Then MkDir DestFolder
NewWb.SaveAs DestFolder & Application.PathSeparator & "Transformation QCHs Lates - " & aKey & Format(Date, "mm-dd-yyyy") & ".xlsx"
Set NewSh = NewWb.Worksheets.Add
NewSh.Name = CStr(aKey)
If Counter > 0 Then
Set Rng = NewSh.Range(NewSh.Cells(1), NewSh.Cells(Counter, Master.ListColumns.Count))
Rng.Value = TransposeArray(MasterDict(aKey))
Rng.Columns.AutoFit
NewSh.ListObjects.Add xlSrcRange, Rng, , xlYes
End If
NewWb.Close True
Next aKey
End If
Active Member
April 12, 2022
Catalin, thank you for your respond.
Would it be too much to ask modify the code shared here: https://www.myonlinetraininghu.....le-reports
I really could not figure out exactly which part to change with the one you just shared. I will then try to figure out how to add data of pivot to shared workbook hopefully.
Regards
1 Guest(s)