Brian,
I did get some of the code from Steve (how to find the last table on a
slide), but I thought I got some (reading all the cells) from PPTools
(wanted to make sure credit was where it was due). However, I probably
really messed it up as I was trying to change data in a cell (original plan)
to where I decided I needed to delete the entire row if the second cell was
empty. (Only two cells per row)
1) If the first cell in a row equals some pre-defined string (e.g., Name)
and the next cell is empy (the name was never filled in - who knows why), I
wanted to delete the entire row, not just leave the second cell empty. So I
might get two rows with data in both cells, then I might get one row with the
second cell empty, then the next two rows with data in both cells, etc.
Completely random.
2) I was able to read each cell and check the first cell on each row for
the pre-defined string. At first, I would just null out the first cell if
the second cell was empty. However, the table ended up with extra lines in
it. Since I was at the correct row when I checked the cell content, I was
hoping it would be simple to delete the row (that is why I sent the snippet
to indicate I knew which row needed to be deleted), and I was at that row
when I was inspecting the cell contents.
3) I looked for some hints on how to accomplish, but couldn't really find
anythig describing it. I have deleted rows in excel, but never in power
point.
4) I assumed you had to delete rows to remove that extra line, but maybe
there is another way.
5) I didn't include all of the code so maybe the snippet was misleading.
As you can tell, I don't have a lot of VBA experience.
Thank you for your patience and help.
Ron
> brm3,
> First, I don't think you got this code from PPTools. Steve and I wrote
[quoted text clipped - 76 lines]
> >> >Thank you
> >> >Ron
brm3 - 12 Sep 2007 03:06 GMT
Brian
Here is the link I used to grab some of the code.
http://www.pptfaq.com/FAQ00790.htm
Ron
> Brian,
>
[quoted text clipped - 114 lines]
> > >> >Thank you
> > >> >Ron
Shyam Pillai - 12 Sep 2007 13:26 GMT
Ron,
I think this is what you are looking for:
Sub Routine()
Dim oTbl As Table
Dim I As Integer
Dim SearchString As String
SearchString = "ACTION OFFICER"
Set oTbl = ActiveWindow.Selection.ShapeRange(1).Table
For I = oTbl.Rows.Count To 1 Step -1
' If the first cell matches the search string and the 2nd cell in the
row is blank
If oTbl.Cell(I, 1).Shape.TextFrame.TextRange.Text = SearchString And _
oTbl.Cell(I, 2).Shape.TextFrame.TextRange.Text = "" Then
oTbl.Rows(I).Delete
End If
Next
End Sub

Signature
Regards,
Shyam Pillai
Image Importer Wizard
http://skp.mvps.org/iiw.htm
> Brian,
>
[quoted text clipped - 128 lines]
>> >> >Thank you
>> >> >Ron
brm3 - 12 Sep 2007 20:08 GMT
Shyam,
This is exactly what I wanted to do. Works perfectly.
Thanks to everyone who helped me with this.
Ron
> Ron,
> I think this is what you are looking for:
[quoted text clipped - 150 lines]
> >> >> >Thank you
> >> >> >Ron
Steve Rindsberg - 12 Sep 2007 21:42 GMT
> Brian,
>
> I did get some of the code from Steve (how to find the last table on a
> slide), but I thought I got some (reading all the cells) from PPTools
> (wanted to make sure credit was where it was due).
Probably the PPT FAQ site rather than PPTools per se.
Brian! Leave 'im alone.
Here's a little example code. A table's .Row has a .Delete method that does what you
want, I think. This assumes you've got a table on the current slide and that it's
selected. You'll want to mod it to suit your code:
Sub DeleteRow()
Dim oTable As Table
Set oTable = ActiveWindow.Selection.ShapeRange(1).Table
With oTable
.Rows(2).Delete
End With
End Sub
However, I probably
> really messed it up as I was trying to change data in a cell (original plan)
> to where I decided I needed to delete the entire row if the second cell was
[quoted text clipped - 109 lines]
> > >> >Thank you
> > >> >Ron
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================