PowerPoint - duplicate table

K

kimkom

Hi,

Can somebody please tell me how to duplicate text from an existing table in
Powerpoint into a similar table on another slide using a VBA macro?

The end user needs to be able to amend the text in the table which is then
duplicated to another three slightly smaller tables in the same presentation.

Although I have been using PP for a while now, I am new to VBA scripting.

Thanks for any help
 
J

John Wilson

Assuming that you have set the object variable to the tables in question you
can copy text from one cell to another with something like this:

otarget_tbl.Cell(2, 2).Shape.TextFrame.TextRange.Text = _
osource_tbl.Cell(1, 1).Shape.TextFrame.TextRange

-------------------------------------------
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
 
K

kimkom

Thanks for the help John, that looks sensible to me. However I am a newbie
with VBA, could you explain how to set object variable (I'm assuming this
refers to oTarget_tbl and oSource_tbl).

Currently my code looks like this:

Sub DuplicateTable()

With
SlideShowWindows(1).Presentation.Slides(2).Shapes("DomTable").Table

.Cell(1, 2).Shape.TextFrame.TextRange.Text = "X"
.Cell(1, 7).Shape.TextFrame.TextRange.Text = "X"
.Cell(1, 12).Shape.TextFrame.TextRange.Text = "X"

End With
End Sub

Obviously that just an initial start (and a small part of the cells in
question) to make sure the correct cells are being called.

Many thanks for your help,
Mike
 
K

kimkom

Thank you John, that has worked a treat.

One final question...

Say I wanted to then duplicate the target table and it's contents another
couple of times on the target table slide... would I have to set up two more
'oTarget_table' variables and copy all the cell text to those also, or is
there a quicker way just to duplicate the entire target table and it's
contents?

Many thanks for your help
Mike
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top