Powerpoint tables

S

Sean

I am automating a powerpoint table from a c# app. Initially, I give the
table a static name in the powerpoint presentation. I then use the table
name to reference the table from my app, however when the text being
inserting into the cell is > than the size of the cell, powerpoint seems to
redraw the whole table, making the cell fit the text but also losing the name
of the table. The problem is when I try to reference the table again it has
changed name to "group 40" for example.

I guess I need one of the following:
1. How can I force the table to keep its given name (best solution)?
2. If not 1, then how can I count the number of groups that are on a
particular slide, so I can keep referencing the last group created (a group
is different to a shape, so I don't seem to be able to do a shape.count kind
of thing)?

Any help appreciated, VB, VBA solutions relevant because the same problem
exists here to!

Cheers

Sean
 
S

Steve Rindsberg

I am automating a powerpoint table from a c# app. Initially, I give the
table a static name in the powerpoint presentation. I then use the table
name to reference the table from my app, however when the text being
inserting into the cell is > than the size of the cell, powerpoint seems to
redraw the whole table, making the cell fit the text but also losing the name
of the table. The problem is when I try to reference the table again it has
changed name to "group 40" for example.

Well that's certainly an ugly little sucker. This seems to work in VBA:

Sub TableIt()
Dim sOriginalName As String
With ActivePresentation.Slides(1).Shapes("Table")
sOriginalName = .Name
With .Table.Cell(1, 1).Shape.TextFrame.TextRange
.Text = "This is quite a bit of text to stuff" _
& " into one poor little cell of a rather" _
& " small table in the left corner of a slide."
End With
.Name = sOriginalName
End With
End Sub
 

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