VBA vs VSTO for excel to powerpoint - vba

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.

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 VBA Chart Generation using Predetermined Templates

I am new to VBA coding, and I have to automate the creation of different charts of 10+ tables of data. The chart design has to be completely the same as it was when it was done manually.
While I did try to use record macros to create the exact type of chart I need for each table, it doesn't generate the same results. Tweaking the code also takes ages for each chart individually.
While saving the wanted chart types as templates does do the trick for only one user, is it possible to somehow save them as templates in the workbook that is being used, so that the code doesn't break when it is sent to other colleagues to update the charts by adding new data?

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

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? :)

Is it possible to export PowerPoint shape in custom format and then import it back to powerpoint?

Have a wierd request.
I have a powerpoint add-in which allows to quickly insert shapes and graphics (also shapes) to the presentation.
It works ok, but the obvious problem I see now is performance, as I store shapes in seperate pptx file.
There are 2 ways I approached working with the shape insertion:
1. Store everything in one presentation and keep it open in the background. The downside is that it makes powerpoint really slow, because the file is just too big (more than 8 mb)
2. Store every slide as a seperate file and open it as needed. This just makes the programm slower, than usual, but works fine. The key downside is that PowerPoint stores every open file in the register and you can not use "recent file" features of the PPT.
What I hoped was possible to do is to save each shape from powerpoint that I heed as seperate file and insert them individually, which would significantly increase the speed of my add-in. However, the only thing I could do is just expoer shape as EMF, which is unacceptable for me.
So my question is: is it possible to export PowerPoint shape in custom format and then import it back to powerpoint? I am using VB.net and VS 2013
Team foundation addin for VS 2013 does something similar, but I need to understant the code and logic behind it and have no idea for now.
You help is HIGHLY appreciated.
Iakov

Excel VBA runs significantly slower after saving the page as a pdf

I have a very strange problem in my excel vba program. I have a ton of vba code that executes queries and formats data. Everything works reasonably quickly. However if I save the page as a pdf and then go back to clicking around and executing more queries. Everything takes significantly longer to run. I have to wait for up to 10 seconds for my queries to execute and show me the data. Before saving as pdf this only took a second. Does anyone have any idea what is going on?
Thanks!
I am using excel 2007. I am creating the pdf via VBA but I have also tested by using the save as pdf button in excel and exactly the same thing happens. It only appears to slow down if I save my entire worksheet as pdf. If I select 1 graph and save it as a pdf it does not slow down. the worksheet I am trying to save consists of several comboboxes, buttons, 2 graphs and table
The answer is: don't save as pdf. Ever.
If you want to provide reports in pdf format, 'print' your workbook (or predefined print ranges) to the virtual printer provided by Adobe, which generates usable pdf files.
Keep the workbook as xls, and treat pdf as a presentation format with limited functionality.