PPT question

D

David Thielen

I haven't figured out a way to determine what cell the cursor is
currently in, or better yet the location of a TextRange object within
a table.

So given a Selection object, I can ask for the TextRange, but when I
ask for its parent ( which should be a TextFrame, whose parent should
be a Shape, whose parent should be a Cell) it is null.

If I ask for a ShapeRange from the Selection, I get the shape that the
table is in.



Is there a way to determine what cell I am given a selection object.
Or better yet, is there a way to determine my position in the table
given a TextRange object, assuming its inside a cell ?



david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
J

Ji Zhou [MSFT]

Hello Dave,

Thanks for using Microsoft Newsgroup Support Service, this is Ji Zhou
[MSFT] and I will be working on this issue with you.

Based on my understanding of the issue, we are now trying to get the cell
where our mouse cursor is currently in. Is my understanding right? If not,
please let me know. I find that Cell.Selected is the only property that
tells the information in the PowerPoint object model. Consequently, I think
we can use the following codes to achieve what we want:

PowerPoint.Selection selection = applicationObject.ActiveWindow.Selection;
PowerPoint.Table activetable = selection.ShapeRange.Table;
for (int i = 1; i <= activetable.Rows.Count; i++)
{
for (int j = 1; j <= activetable.Columns.Count; j++)
{
if (activetable.Cell(i, j).Selected)
{
Debug.Print("The current selection is in " +
selection.ShapeRange.Name + " Cell(" + i.ToString() + ", " + j.ToString() +
")");
}
}
}

The above code firstly gets the selection object from the ActiveWindow.
After that, it gets the table from the selection.ShapeRange.Table, and
iterates through all cells in the table to see whose Selected property
returns true. The selected cell is we are looking for.

Please let me know whether this works for you or not. And if you have any
other concerns, please feel free to contact me. I will do my best to help.


Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top