How to paste into tables from other office applications?

B

Bojana

How can I paste information from an excel or word table for example so that
if I have 4X4 table in Excel, the content of cells is pasted in my
(pre-formatted) ppt table in the cells as well. The only thing I am getting
so far is 4 separate text objects and that is not what I need...

Thanks
 
P

pdstephens

It's easier to copy the cells in Excel you want. In PowerPoint, place your
mouse in the slide/area. Click Edit, Paste Special, Excel Object. Check the
Link box if you want it linked. You can adjust the size by dragging the
corners. Double click the object and you can edit the Spreadsheet. Hope
this helps.
 
B

Bojana

Not really. I knew that but I have a situation where I have to use PowerPoint
tables.
 
B

Brian Reilly, MVP

You can work with each cell in a table kind of like you work with a
range in Excel using the R1C1 concept. Read the VBA Help on Tables for
examples.

Here's a copy of one of the Help files

Working with Tables
See AlsoSpecificsIn Microsoft PowerPoint, you can create native tables
without having to import them from Microsoft Word. Tables are members
of the Shapes collection. Each cell, column, and row in a table is a
separate programmable object.

Creating a Table
To create a table on a slide, use the AddTable method. This method
adds a table to the Shapes collection with the number of rows and
columns designated by the NumRows and NumColumns arguments. This
example adds a table with three rows and four columns to slide two.

ActivePresentation.Slides(2).Shapes _
.AddTable NumRows:=3, NumColumns:=4, Left:=10, _
Top:=10, Width:=288, Height:=288

Testing to See Whether a Shape Is a Table
Before you can work with the contents or objects in a table, you must
first know if the shape you are working with is a table. To see
whether a shape is a table, use the HasTable property. For example,
assume that slide one has numerous shapes and you know one of them is
a table. You want to resize this table so that it's the proper size to
accept the data you are going to import from another source. This code
walks through the Shapes collection on slide two to find the table and
then it resizes the width of the columns.

With ActivePresentation.Slides(2)
For sh = 1 To .Shapes.Count
If .Shapes(sh).HasTable Then
For Each col In .Shapes(sh).Table.Columns
col.Width = 110
Next col
End If
Next
End With

Working with Cells, Columns, and Rows
To return the contents and properties of an individual column or row,
use a specific member of either the Columns or the Rows collection.
The Cell method returns a single Cell object within a Table. This
example changes various attributes of the table represented by shape
five on slide two. It changes the color of row two, the width of
column one, and the text contained in the row two, column one cell.

With ActivePresentation.Slides(2).Shapes(4).Table
For Each cl In .Rows(2).Cells
cl.Shape.Fill.ForeColor.RGB = RGB(50, 125, 0)
Next cl
.Columns(1).Width = 110
.Cell(2, 1).Shape.TextFrame.TextRange.Text = "Mallard"
End With

Brian Reilly, MVP
 
B

Brian Reilly, MVP

Yup, you seem to be correct. Can't group OLE objects with PPT tables.
Hate those PPT tables. Remind me of MS Grump when you should just use
Excel.

Brian Reilly, MVP
 

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