Link to home
Create AccountLog in
Avatar of wsturdev
wsturdevFlag for United States of America

asked on

How to create PowerPoint table template, then copy and fill

I have an Access 2003 app that loops through the records from a query and builds tables in PowerPoint.  But it is slow because every table, even though identical in all attributes except the cell values from the last, is built separately.

Is there any way to build a "Template" table, then copy it to a new slide and just fill in the cells?
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

wsturdev,

Probably, but my guess is that it is the loading of the tables that takes up most of the time, so I don't think it would be any faster.

Click the "Request Attention" button in your original post and ask that the PowerPoint Zone be added to this question as well.
Perhaps the expert there can provide more insight.

JeffCoachman
Avatar of wsturdev

ASKER

I attached a tag of "PowerPoint" when I posted the question so I thought that would happen, but I will do as you suggest.
I have done as you suggested.

Meanwhile, my assumption of improved speed using a template is based pretty much on the idea that I would significantly reduce the amount of code begin executed.
I figured out how to create a table, then copy it and paste it, just changing the data values in the pasted copy.  And the time savings is amazing.! In a test to produce 62 tables of exactly the same structure, one per slide, using the old method of completely building every table took 2022 seconds.  Building the first table and then copying and pasting it 61 times and just replacing the values only takes 23 seconds.

However, I still have a problem.  I need to figure out how to shrink or expand a row to accommodate differing lengths of data in certain cells.

One thing I have tried is to loop through the records before actually creating the tables and isolating the longest text value in each data cell, then using that as the value to build the "template" table.  This allows me to always make sure the rows are the proper height.  However, now I need to be able to collapse the height of each row to only be high enough to accommodate the values in that row of that particular table.

Any PowerPoint experts who can help with that?
I solved my problem, but would love it if a PowerPoint VBA expert could explain why this is:

I was unable to find a method of telling a row to expand or collapse to just the height that is high enough to accommodate the cell within the row that needed the most height.

But, I discovered that if, after pasting the slide, and replacing all of the text in the data cells (no need to replace the text in the header cells) of the table, if I then added a new row at the end of the table and filled it with the same text as the row above, and then immediately deleted that new row, every row remaining in the table expanded or shrunk to fit accordingly!!!
Just realized I stated my solution slightly wrong...

I discovered that if, after pasting the slide, and replacing all of the text in the data cells (no need to replace the text in the header cells) of the table, if I then added a new row at the end of the table and filled it with the same text as the row above, and then immediately deleted that row above, every row remaining in the table expanded or shrunk to fit accordingly!!!

For example, if I have 14 rows in the table, I add row 15, which has the same cell layout, font, etc. as row 14, then put the exact same text into row 15 as in 14, then delete row 14, the entire table adjusts its height to fit every row.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer