PC Review


Reply
Thread Tools Rate Thread

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

 
 
doodleM
Guest
Posts: n/a
 
      10th May 2010
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

 
Reply With Quote
 
 
 
 
Shyam Pillai
Guest
Posts: n/a
 
      10th May 2010
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" <(E-Mail Removed)> wrote in message
news:B41464CC-1EC0-4089-BA73-(E-Mail Removed)...
> 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
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get the current cursor position in a TextBox Tony Johansson Microsoft C# .NET 5 21st Apr 2009 04:34 PM
Function to determine current cursor position? Dan Microsoft Excel Worksheet Functions 1 12th Mar 2009 02:56 PM
How to determine the current position of an open .xls file? =?Utf-8?B?QW5kcmV3?= Microsoft Excel Programming 3 20th Mar 2007 10:09 PM
How do I fetch current cursor position tony Microsoft C# .NET 2 23rd May 2006 02:43 PM
how do I get the current cursor position in a spreedsheet =?Utf-8?B?UGF1bCBK?= Microsoft Excel Programming 4 1st Oct 2004 01:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:45 PM.