How to determine the current cursor position in the selection of a

  • Thread starter Thread starter doodleM
  • Start date Start date
D

doodleM

How to determine the current cursor position in the selection of a Table cell
in Powerpoint 2007 using vb.net

If the selection type is text, then the
ActiveWindow.Selection.TextRange.Start property returns the current position
at which the selection begins within the parent text range. In this snippet
we try to determine within which paragraph in the text range does the cursor
selection begin.


Sub CurrentTextSelectionParaPosition()
Dim oShp As Shape
If ActiveWindow.Selection.Type = ppSelectionText Then
Set oShp = ActiveWindow.Selection.ShapeRange.Item(1)
With ActiveWindow.Selection.TextRange
For I = 1 To oShp.TextFrame.TextRange.Paragraphs.Count
If oShp.TextFrame.TextRange.Paragraphs(I).Start +
..TextFrame.TextRange _
..Paragraphs(I).Length > .Start Then
MsgBox "Current selection begins in paragraph number: " & I
Exit For
End If
Next I
End With
End If
End Sub


But this is not working when I select the cell of a Table in Powerpoint
Slide for this I am using :

ActiveWindow.Selection.ShapeRange.Table.Cell(rowIndex, colIndex).Selected =
True ActiveWindow.Selection.ShapeRange.Table.Cell(rowIndex,
colIndex).Shape.TextFrame.TextRange

It always gives me the entire paragraphs text of a cell.


Kindly help, any pointers will be appreciated

Thanks,
doodle
 
Back
Top