A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old May 10th, 2010, 09:46 AM posted to microsoft.public.powerpoint
doodleM
external usenet poster
 
Posts: 2
Default 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  
Old May 10th, 2010, 07:22 PM posted to microsoft.public.powerpoint
Shyam Pillai
external usenet poster
 
Posts: 622
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.