COM automation of bulk table creation and table cell background changes

  • Thread starter Thread starter Erwin S. Andreasen
  • Start date Start date
E

Erwin S. Andreasen

I am using the PowerPoint COM interface (specifically from Python, but
the method/property names are the same were I to use VB) to create a
presentation which contain tables. I have two issues:

1) since I have a lot of data to copy over, I would like to copy it to
the clipboard and then copy it to the already properly resized tables,
rather than set each cell individually (I use such a bulk copy method
to set up OLE charts within the presentation already)

2) I would like to change the background color of the cells

However, I can find no sign of the above being possible when looking
at the Office 2003 PPT docs. I have tried recording a macro and
performing those actions -- nothing is recorded when they are
performed.

Any suggestions? My fallback, if the COM interface for at least #2 is
unavailable (#1 just means worse performance) is to use something like
"Watsup" to programmatically send key strokes/mouse clicks to
Powerpoint, but that seems rather inelegant.

http://www.tizmoi.net/watsup/intro.html
 
Erwin, Shyam,

I'm doing a similar operation on a project I'm working on - it works OK, but
the performance is terrible. Can you explain a little more about "preventing
the window from redraw or perform the automation while PPT is not visible"?

I've tried using Automation without making the Powerpoint application
visible, but when I do so, I get an error. In other words, this code:

Dim oApp
Set oApp = CreateObject("Powerpoint.Application")
Dim oPres
Set oPres = oApp.Presentations.Open("C:\Presentation.ppt")

Creates this error:

"Presentations.Open : Invalid request. The PowerPoint Frame window does not
exist"

Any advice or insight would be greatly appreciated.

Cheers,
Matt Stuehler
 
a) You can lock you screen from redrawing - http://skp.mvps.org/ppt00033.htm
b) Automate PPT in invisible mode:
Dim oApp
Dim oPres
Set oApp = CreateObject("Powerpoint.Application")
Set oPres = oApp.Presentations.Open("C:\Presentation.ppt", , , False)
 
Shyam,

That "Lock screen" is a VERY useful bit of code! Many thanks for sharing it!

Cheers,
Matt
 
Back
Top