From: doodleM on 10 May 2010 04:46 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
From: Shyam Pillai on 10 May 2010 14:22 I've updated the page from where you've picked up this snippet to show you can extend it to locate the position within a table. http://skp.mvps.org/ppt00041.htm -- Regards, Shyam Pillai Handout Wizard: http://skp.mvps.org/how. PowerPoint 2010 (32-bit/64-bit) versions supported. "doodleM" <doodleM(a)discussions.microsoft.com> wrote in message news:B41464CC-1EC0-4089-BA73-48187B881A86(a)microsoft.com... > 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 >
|
Pages: 1 Prev: For now try WAV format... Next: Change all PowerPoint images to grayscale? |