update embedded excel pivot in powerpoint using VBA Code - excel

I have some pivot tables in powerpoint that I embedded. I chose to embed rather than just regular linking as I need to update the pivot tables daily and need to shape them to give only the relevant information.(Sometimes there is more data than the day before which cannot be seen when linking normally as the"window" is fixed.)
I am still very new to the VBA coding field and require a code that will open my Microsoft excel worksheet opject then refresh the pivot inside the object and close it again. I have written code to open the document, save and close the document which is working correctly. I only require that little refresh bit.
Many thanks in advance

Related

EXCEL - PPT data refresh

I have an issue with excel refresh and updating data to Power point.
Current Setup : Excel charts are linked to PPT and macro is written to refresh excel data and updating charts in PPT. But the process is taking very long time as I have around 30 charts linked using 30 different excel workbooks which in turn has link to database to get the data.
I need help to get out of this issue. I have tried using automatic update links in Power Point which is little ok in performance, but the question here is does it also refresh data in excel ?

Excel chart as ole object in access form doesn't update properly

I have an access form where I have included an excel chart as an unbound ole object. (MS Graphs in access are so terrible!) The excel sheet is an independent file, outside the database. Through a DoCmd.TransferSpreadsheet instruction I can export the results of a query to the excel sheet. The graph in excel updates itself, but no change appears in the form, and I don't know how to force the update. I have tried to update the object with the .requery statement, but it does not update. If I manually open the object from the form it does.
Any way to force the update immediately after doing the export?
Thank you very much
Well, it seems i've found some kind of solution to this. I've created a bounded frame to the excel chart. Once the base data of the chart is updated, just setting the focus in the frame through VBA updates the chart. It's the same as one-clicking the frame. This works only for bounded frames. It doesn't work for unbounded frame, in spite of linking it to the excel file.
I don't understand why, but it works for me.
Thanks everyone.

How to inject excel data to embed powerpoint chart with VBA

I want to know how we can inject excel data into embed powerpoint chart.
Any information that I search taught me how to do it, but with create new presentation. I need to update the existing chart from powerpoint using data from excel.
And the method should not be update link or something. Because I deal with more than hundred charts, I'm afraid linked method will take huge resource that cannot handle by my device. The other reason is I need to keep the chart editable in powerpoint (something that cannot done with paste link method).
Any suggestion?
Thanks
it depends of the version of you office. I have 2016 office, so it is very simple to do
these are the steps
Go to INSERT and lok for "Tables", then the opcion called (excel)
An excel view is going to open, then in the sheets you can inser your information, make a table format also
In the excel view the go to Insert, Recommended graphics and select the one you want
here some photos
step 1
excel view

Convert linked excel into embedded excel

I have a ppt presentation with hundreds of charts that are all linked to the same .xls file. I want to send the presentation to the client and I want him to be able to access the data. However, I do not want him to open the entire xls file when he clicks on edit data.
So what I would like to do is to "convert" the linked charts to charts with an embedded excel that only contains the data concerning the specific chart.
(I am not sure if that's the right way to put it. I feel like the distinction between embedded and linked is not as clear cut anymore as it used to be in previous office versions)
I have found a macro for ppt 2003 that simply copies the old chart and does
Set oSh2 = oSl.Shapes.PasteSpecial(ppPasteOLEObject)(1)
but I think this does now longer work ( I am working with ppt 2013).
Any ideas on how to do this are highly appreciated. Many thanks
If you don't want to give him access to the entire original workbook/worksheet, you'll need to create multiple worksheets, each with just the data you DO want him to be able to get at and then either link or embed those into your PPT file.
If you create the charts using the old MS Graph mini-app (still included, if optionally, with Office) you can link data from an external Excel file into the graph datasheet. I'm almost certain that doing it this way will give others access to the graph datasheet (ie JUST the data used for the graph) but not to the linked source XL file.
I don't see a way of doing this with the new chart engine.

How to to add VB Excel Script in Excel Generated Jasper Report?

Current Excel Report is created using Jasper Server / Jasper Report 3.8.
In my case , I would like to create Pivot Excel automatically using Excel(Since Jasper Report Crosstab is not sufficient for my client requirement), so i have an idea to add VB Script that will create Pivot Table when the generated jasper report is opened for first time.
I have created the VBA script However I couldn`t find a way to integrate the VBA with Jasper Report (generated) so that when I generated the Report, the VBA is also included in the Report.
Could anyone tell me how to to add VB Excel Script in Excel Generated Jasper Report?
Added Constraint:
List item
The Data Source (Excel File Containing Data) is protected
I know the question has been answered and accepted, but I just cannot resist to add a thought .....
Could it be that this question is asking to put the cart in front of the horse?
You create an Excel File REP using a report generator. Then you want to use this data as the source of an Excel Pivot table. As I see it there are a couple of possibilities to do that:
Create another Excel file PIV containing a structure of REP with some sample data to create the Pivot definitions
Copy / Paste the REP data replacing the existing content each time you draw a new REP
refresh the Pivot
This can be automated in PIV, asking for the source file name etc., so there is actually no need to touch REP in any way. As an alternative to copy / paste you can just use an external link to REP when you specify the data source for the pivot table, and change this every time the user wants to analyze a new REP.
Hope this helps
I think MikeD has the right idea here. I've never used Jasper, but if it's a CSV or Excel file, why not write a block in your macro script that opens the Jasper report, makes the pivot table then saves it again.
It's honestly been years since I've done VBA but this code was what I found online for opening workbooks (ref: http://p2p.wrox.com/excel-vba/10510-opening-excel-file-vba.html)
Dim oExcel as Excel.Application
Dim oWB as Workbook
Set oExcel = new Excel.Application
Set oWB = oExcel.Workbooks.Open(<pathToWorkbookHere>)
Forgive the syntax on this as it's from 10 year old memories, but from there, you could do things like
oWB.Sheets(1).Cells.Copy
ThisWorkBook.Sheets("PIVOTDATA").Cells.Paste()
ThisWorkBook.Sheets("PIVOTTABLE").Cells.Refresh
ThisWorkBook.Saveas("<path to new report>", xlExcel12)
If your reports are done by date, you could programatically select either the latest, load the folder and parse all of them, or whatever you'd like. Your template file is the one running the script, and saves copies of itself in a "does not contain a macro" state, so your users never get the security warning.
If you correctly determine the filename programatically, set the code to run "ON OPEN" in the template macro, and run a thisworkbook.close at the end of the script, all you've got to do is create a batch file that opens your workbook automatically on the command line
excel.exe <template_filename>
then set a windows cron-job (called a scheduled task) to run automatically every day, right after your jasper report runs.
Sorry if some of this is "hit and miss" in terms of syntax. I've not been elbows deep in Excel VBA for over 10 years, but I wrote a system like this at the time that was generating hundreds of beautifully formatted excel reports every day ... pivot tables and all.
It's totally achievable and you're on the right track.
By looking the answer on Jasper Tracker, seem that this feature is not supported by jasper report and will not be including in new feature
this (Adding VBA Script to Excel Generated Jasper Report) is such a specific Excel feature that I'm pretty sure we will
never implement. This is mostly because JasperReports is not an XLS
generating library, but rather a reporting tool with Excel output
capabilities
See this link for detail.

Resources