Generate PowerPoint presentations with Excel sheets / charts embedded in it programatically - vba

So what my client wants to accomplish seems pretty simple. We will have PPTX file template with a few Excel sheets embedded in it, and a few charts too.
We have created such template file. We are able to extract it, update excel files that sit in ppt/embedded directory with new ones, and pack it back.
The problem is, the display values of the tables or charts do not update automatically when such file is opened. You have to double click on a spreadsheet table or chart to trigger "edit mode". When you leave it the charts are updated.
We figured that internally, PowerPoint is doing screenshots of tables or charts, and uses it to display presentation. This is probably to allow presentation players that do not come with Excel to correctly render the presentation with embedded sheets.
Is there a way I can programatically update the screenshots of tables/charts? Is there some sort of API from Microsoft that would allow me to do that, like "MS Office API".
Maybe there is some way to have MS office configured/scripted, so I send it a file, it runs a VB script on it and returns updated value? I figured I can actually trigger update to screenshots with VB script. But I don't know if I can orchestrate Office program to do what I want.
Help? :)

Related

PowerPoint Macro in a template

I am currently working on creating a template for a business presentation.
After the current client's name is written in the starting slide I want to be able to take it and place it on X amount of slides later created via a template, so that manual entry is almost completely reduced (this is a prerequest for the task).
Is it possible to create a macro so that it either edits the template slides after the needed information is written on the 1st slide or that it controls all the user created slides and labels afterwards?
What you're after is possible so long as the user can either install an add-in that you've written to do the job or open a file that you've saved as a PPTM rather than PPTX (ie, one with macros/vba included).

Excel and Sharepoint integration

I can't really find a clear answer or solution for my problem.
What I have is the following: An excel file where a user inputs data in a UserForm and that data is then added to a table in this same excel file. Multiple users will get such an excel file so that they can add data on their own.
What I want to do is to aggregate this data in my own Excel file. Or Sharepoint List. I don't really prefer any option as both would work for me.
The user excel file is done and works. All that is left to do is to send the data in the table to a sharepoint list by clicking a button on the excel file.
I am able to import the excel data to sharepoint just fine, but I want the user to be able to "upload" the data to sharepoint by clicking a button. I did find code for that but it appears to be outdated as some functions are not used in Sharepoint anymore.
Does anyone have a solution or an idea how I can create a button in my excel sheet to send the data from several excel files (each with their own button) to a singular sharepoint/excel file (which would be my file).
I have been looking for days and tried powerapps, sql, acces and other approaches but none worked as they should.
Thanks!

Word VBA to refresh embedded Excel chart

I have embedded charts in a Word doc. When I update the data in Excel, so that the chart in the Excel workbook updates, and then go to the Word doc, I can manually select the embedded chart, select Design > Refresh Data, and the embedded chart in Word updates to show the new data.
When I try to record the Word VBA to do that, it won't let me do those actions.
I've looked everywhere I can think of in Word's object browser. I see that I can identify the embedded chart like this:
thisdocument.InlineShapes(1)
But I don't see how to refresh it. What do I need to do?
I found the answer here:
http://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-msoffice_custom/what-is-the-vba-equivalent-of-refresh-data-for/b8405aca-716a-e011-8dfc-68b599b31bf5
thisdocument.InlineShapes(1).LinkFormat.Update
It worked fine in my tests.
And to break the link (in the word template) after updating, to avoid inadvertently updating the chart to one from a later run showing different data:
thisdocument.InlineShapes(1).LinkFormat.BreakLink

How to Make a VBA Excel Program Work on Other Excel Documents?

I'm very new with VBA Excel and i only know the things as far as i need for this report formatting task. My code is almost completed, but what i wonder is, how can i make my program work on several documents?
I mean, i want to choose an excel file via my program, then i want to start the process of report formatting. Then maybe user need to format another document, i want my program to be able to format that document too. how can i achieve that?
Thanks in Advance
Timur
The way I am currently doing this is by creating an Excel add-in. To do this, place your macros and forms into a new, empty Excel workbook and save as a .xlam document.
To use the macros, open the your Excel file and the add-in. To open the add-in automatically, save it to "C:\Program Files\Microsoft Office\Office12\XLSTART" (Vista).
You can even create a custom ribbon for your add-in using the Custom UI Editor for Microsoft Office http://msdn.microsoft.com/en-us/library/office/ee691832(v=office.14).aspx (The download link is at the end of the instructions)

VBA vs VSTO for excel to powerpoint

I'm currently considering a number of options for copying an excel sheet into a powerpoint presentation.
Using VBA select a excel sheet, copy the range and place it into a newly created powerpoint slide as an image.
I create excel automated html of a sheet, once that html is saved(initially), i create an image off of the html.
Using VSTO, i open Excel copy each object and paste it into a new powerpoint slide, using the clipboard(or another copy method).
These operations will be called frequently, by many different users - all the actual operation occurs on a single server.
What would the pros and cons of each approach be? Are there any prefered or better optimized techniques available?
Option 1:
Pro:
Speed
Contra:
The inserted Data can't be copied, altered, viewed within excel etc.
Option 3:
A couple of years ago I wrote a similar VBA-Procedure that created a >1000 Slides Presentation from an Excel Sheet. The method was called from Excel and went AFAIR like this(pseudo-code):
newSlide = PowerPoint.AddSlide
embeddedSheet = newSlide.Add OLEObject(Excel-Sheet)
embeddedSheet.Range(..., ...) = srcSheet.Range(..., ...)
someFormating(embeddedSheet)
createPieChart(embeddedSheet.Range(..,...))
resize(embeddedSheet)
embeddedSheet.Save
embeddedSheet.Close
Pro / Contra based on my experience with the method above.
Pro:
The Sheet is embedded in PowerPoint
you can alter the Data and run Macros on it.
you do not need to keep the original Excel sheet.
Contra:
The Output-File is bigger
The Process uses a lot of RAM.
The Process takes relatively long. AFAIR 1k Slides took about 10 Minutes on the computer in my office. Creating the OleObject took the majority of the time.