• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Automating and Emailing Pivot Table Reports [Upload Excel instead of PDF]|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Automating and Emailing Pivot Table Reports [Upload Excel instead of PDF]|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosAutomating and Emailing Pivot Table…
sp_PrintTopic sp_TopicIcon
Automating and Emailing Pivot Table Reports [Upload Excel instead of PDF]
Avatar
kemal ali

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
April 12, 2022
sp_UserOfflineSmall Offline
1
April 12, 2022 - 4:32 pm
sp_Permalink sp_Print

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

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
April 13, 2022 - 1:43 pm
sp_Permalink sp_Print

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.

Avatar
kemal ali

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
April 12, 2022
sp_UserOfflineSmall Offline
3
April 13, 2022 - 4:59 pm
sp_Permalink sp_Print

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!

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
4
April 13, 2022 - 5:17 pm
sp_Permalink sp_Print

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

Avatar
kemal ali

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
April 12, 2022
sp_UserOfflineSmall Offline
5
April 13, 2022 - 5:34 pm
sp_Permalink sp_Print

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

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
6
April 13, 2022 - 7:08 pm
sp_Permalink sp_Print

Sure, why not, here it is.
The code is emailing data tables, not pivot tables.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Velouria, Riny van Eekelen
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Sopi Yuniarti
LAFONSO HERNANDEZ
Hayden Hao
Angela chen
Sean Moore
John Chisholm
Forum Stats:
Groups: 3
Forums: 24
Topics: 6216
Posts: 27250

 

Member Stats:
Guest Posters: 49
Members: 31897
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.