Best way to change style of a table

C

Clifton Ivey

I have a table I added via VBA like this:

set oTable = ActivePresentation.Slides("mySlide").Shapes.AddTable(...)

I then add some cells to it by:

oTable.Cell(...).Shape.TextFrame.TextRange.Text = "some text"

However, I cannot get a handle on these cells to update the font, fill, etc.

What is the best way to do this?
 
S

Steve Rindsberg

I have a table I added via VBA like this:

set oTable = ActivePresentation.Slides("mySlide").Shapes.AddTable(...)

I then add some cells to it by:

oTable.Cell(...).Shape.TextFrame.TextRange.Text = "some text"

However, I cannot get a handle on these cells to update the font, fill,
etc.

What is the best way to do this?

oTable.Cell(x,y).Shape gives you a reference to the shape that represents
the cell.
You can format it using the same properties as you would any other shape.




--
================================
Steve Rindsberg
PPTools add-ins for PowerPoint
http://www.pptools.com
The PowerPoint FAQ
http://www.pptfaq.com
 
C

Clifton Ivey

Is there any way to modify them as a group? As opposed to modifying each
individual cell.
 
C

Clifton Ivey

Thanks Steve. I am afraid you are correct and there is no simple way to do
what I want, but I had been led to believe from researching this that it may
be possible to interact with the cells in a table as a ShapeRange. I even
found a couple of examples, but couldn't get them to work.

The code I've tried looks like this:

With oSlide.Shapes.Range("myTablesName")
With .Fill
.Visible=True
.BackColor.SchemeColor = ppShadow
End With
With .TextFrame.TextRange.Font
.Italic = msoTrue
.Color.RGB = RGB(125, 0, 125)
End With
End With

======== end code ============

From what I've read I thought the cells are shapes embedded in the table
which is also a shape. So why can't I get a handle on it as a Range?

Thanks again,
Brian
 

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