Enter text in a table for powerpoint 2007?

  • Follow


Does anyone know how to fill in a Powerpoint table with MATLAB? I can
do program everything else I need it to do but when I use the Cell
method I get an error stating "??? No appropriate method, property, or
field Selection for class
Interface.Microsoft_PowerPoint_12.0_Object_Library.Shape."

My code is

PPT = actxserver('PowerPoint.Application');
PPT.Visible = true;
PPTpres = invoke(ppt.Presentations,'Add');
Slide1=invoke(PPTpres.Slides,'Add',1,12);
Table1=Slide1.Shapes.AddTable(3, 4, 10, 10, 288, 216);
Table1.Cell(1, 1).Shape.TextFrame.TestRange.Text='test'

I've tried several different variants of the last line and nothing has
worked yet.
Thanks,
Rick
0
Reply rickcanham (2) 1/25/2010 11:32:59 PM

rickcanham <rickcanham@hotmail.com> wrote in message <71a3ac6c-15cd-4262-af0e-ed5e7927b597@33g2000yqo.googlegroups.com>...
> Does anyone know how to fill in a Powerpoint table with MATLAB? I can
> do program everything else I need it to do but when I use the Cell
> method I get an error stating "??? No appropriate method, property, or
> field Selection for class
> Interface.Microsoft_PowerPoint_12.0_Object_Library.Shape."
> 
> My code is
> 
> PPT = actxserver('PowerPoint.Application');
> PPT.Visible = true;
> PPTpres = invoke(ppt.Presentations,'Add');
> Slide1=invoke(PPTpres.Slides,'Add',1,12);
> Table1=Slide1.Shapes.AddTable(3, 4, 10, 10, 288, 216);
> Table1.Cell(1, 1).Shape.TextFrame.TestRange.Text='test'
> 
> I've tried several different variants of the last line and nothing has
> worked yet.
> Thanks,
> Rick

Why don't you use the activex for excel, then import the excel table to powerpoint. I mean excel is very easy to do , and there are lots of documentation on that.
0
Reply ade77 1/26/2010 12:15:24 AM


Dear Rick

This works:
Table1.Table.Cell(1,1).Shape.TextFrame.TextRange.text = 'Test'

using the "code complete" (pressing "tab") and functions like get and inspect can help you out on these not-documented features.

There are many reason to NOT go via Excel. For instance, if you open an existing ppt/pptx, the table you create folows any masters in the presentation.

Peter

rickcanham <rickcanham@hotmail.com> wrote in message <71a3ac6c-15cd-4262-af0e-ed5e7927b597@33g2000yqo.googlegroups.com>...
> Does anyone know how to fill in a Powerpoint table with MATLAB? I can
> do program everything else I need it to do but when I use the Cell
> method I get an error stating "??? No appropriate method, property, or
> field Selection for class
> Interface.Microsoft_PowerPoint_12.0_Object_Library.Shape."
> 
> My code is
> 
> PPT = actxserver('PowerPoint.Application');
> PPT.Visible = true;
> PPTpres = invoke(ppt.Presentations,'Add');
> Slide1=invoke(PPTpres.Slides,'Add',1,12);
> Table1=Slide1.Shapes.AddTable(3, 4, 10, 10, 288, 216);
> Table1.Cell(1, 1).Shape.TextFrame.TestRange.Text='test'
> 
> I've tried several different variants of the last line and nothing has
> worked yet.
> Thanks,
> Rick
0
Reply Peter 3/22/2010 4:31:26 PM

Hi all,
I have a similar but slightly different problem: I need to update some tables periodically, I don't want to change the format (color, font etc) of existing tables,  only need to update the numbers. I guess this can be done by something similar to   "Table1.Table.Cell(1,1).Shape.TextFrame.TextRange.text = 'Test'"
but how do I get the reference to "Slide1" and "Table1" in the first place?  I'm not creating new slide or table, but try to access existing ones.
Many thanks.
0
Reply jjg_huang 4/15/2011 1:13:05 PM

> PPT = actxserver('PowerPoint.Application');
> PPT.Visible = true;
> PPTpres = invoke(ppt.Presentations,'Add');
> Slide1=invoke(PPTpres.Slides,'Add',1,12);
> Table1=Slide1.Shapes.AddTable(3, 4, 10, 10, 288, 216);
> Table1.Cell(1, 1).Shape.TextFrame.TestRange.Text='test'

Replace last line with:
Table1.Table.Cell(2,2).Shape.TextFrame.TextRange.Text = 'test'
0
Reply alain.brenzikofer1121 (1) 5/2/2013 7:40:08 AM

4 Replies
662 Views

(page loaded in 0.09 seconds)

Similiar Articles:













7/26/2012 3:08:48 AM


Reply: