Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / August 2006

Tip: Looking for answers? Try searching our database.

Shape.Table goes missing when filling Powerpoint table with Excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Glenn H - 10 Aug 2006 02:53 GMT
Hi,

I am working on an application that uses data in Excel to create Powerpoint
slides based on an existing Poiwerpoint template.

I am running into an error that occurs only under certain conditions.  The
error occurs when the VBA tries to take data from Excel and put it into a
Powerpoint table. The error text is:

"Shape.Table : Invalid Request.  This shape does not have a table."

The conditions under which the error occurs are:

1. I have already run the code once (it always runs correctly the first time).
2. I have not closed Powerpoint since I previously ran the code (closing and
restarting Powerpoint keeps the error from occuring, even though the VBA is
actually in an Excel workbook and I have not restarted Excel).

The data does not seem to be the problem, as I can use the same data for the
first run and get the correct output, then use it again on the second run,
and get the error.

The odd thing is that if I run the code in debug mode, I can click "Run" in
the VB Editor after getting the error, and the code completes correctly -
even though I changed nothing.

Here is the offending section of code:

=======================================
                   For iColumn = 1 To .Shapes(j).Table.Columns.Count
                       If iColumn > .Shapes(j).Table.Columns.Count Then
Exit For
                       
                       iRow = 1
                       Do While iRow <= .Shapes(j).Table.Rows.Count
                               iReturnValue =
replace_ppt_shape(.Shapes(j).Table.Cell(iRow, iColumn).Shape,
dFieldsToReplace, sNotFound, True)
                               
                           If iReturnValue = 0 Then
                               ' Nothing was replaced
                               iRow = iRow + 1
                           ElseIf iReturnValue = 1 Then
                               ' Text was replaced
                               .Shapes(j).Table.Rows(iRow).Height = 12
                               iRow = iRow + 1
                           ElseIf iReturnValue = 2 Then
                               ' N/A was found - delete the row
                               .Shapes(j).Table.Rows(iRow).Delete
                           ElseIf iReturnValue = 3 Then
                               ' N/C was found - delete the column
                               .Shapes(j).Table.Columns(iColumn).Delete
                           End If
                       Loop
                   Next
==============================

Glenn Hollister
Steve Rindsberg - 14 Aug 2006 03:01 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> "Shape.Table : Invalid Request.  This shape does not have a table."

What happens *prior* to the code you've quoted?  It seems that you may have
referenced a shape that isn't a table.

> The conditions under which the error occurs are:
>
[quoted text clipped - 43 lines]
>
> Glenn Hollister

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.