If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to determine the current cursor position in the selection of a
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(rowIn dex, colIndex).Selected = True ActiveWindow.Selection.ShapeRange.Table.Cell(rowIn dex, colIndex).Shape.TextFrame.TextRange It always gives me the entire paragraphs text of a cell. Kindly help, any pointers will be appreciated Thanks, doodle |
#2
|
|||
|
|||
How to determine the current cursor position in the selection of a
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" wrote in message ... 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(rowIn dex, colIndex).Selected = True ActiveWindow.Selection.ShapeRange.Table.Cell(rowIn dex, colIndex).Shape.TextFrame.TextRange It always gives me the entire paragraphs text of a cell. Kindly help, any pointers will be appreciated Thanks, doodle |
Thread Tools | |
Display Modes | |
|
|