I need to get the selected cells of a table.
I tried the following code
Set oTbl = .ShapeRange(1).Table
For x = 1 To oTbl.Rows.Count
For y = 1 To oTbl.Columns.Count
If oTbl.Cell(x, y).Selected Then
With oTbl.Cell(x, y).Shape
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Visible = True
End With
End If
Next
Next
This works fine if you are using vba, but im creating a vsto using vb.net and it colors the complete table using the below code
Dim oShape As PowerPoint.Shape = Nothing
Dim oTable As PowerPoint.Table
With Globals.ThisAddIn.Application.ActiveWindow.Selection
For Each oShape In .ShapeRange
oShape.Select()
Exit For
Next
oTable = oShape.Table
Dim i As Integer = 0
Dim j As Integer = 0
For i = 1 To oTable.Rows.Count
For j = 1 To oTable.Columns.Count
If oTable.Cell(i, j).Selected = True Then
With oTable.Cell(i, j).Shape
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoTrue
End With
End If
Next
Next
End With
Please help
Thanks
Leroy M