So that seems to work if the cell is actually selected. Is there any way to
tell if the cursor is just sitting in the cell, not necessarily selected?
Also, is there a WithEvents statement that I can use to capture a user
clicking or moving from cell to cell in a table?
Thanks!
Rob
> So that seems to work if the cell is actually selected. Is there any way to
> tell if the cursor is just sitting in the cell, not necessarily selected?
Good question. See below for your other question.
As to the first:
Sub TableTest()
Dim x As Long
Dim y As Long
Dim oSh As Shape
Dim oRng As TextRange
If ActiveWindow.Selection.Type = ppSelectionText Then
' The parent of the current text select is the shape's TextRange
' The parent of the TextRange is the shape itself
' We'll use that to get the name of the shape
' and compare that to the name of each cell in the table to see if we have a
match
Set oRng = ActiveWindow.Selection.TextRange
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh.Table
For x = 1 To .Rows.Count
For y = 1 To .Columns.Count
If .Cell(x, y).Shape.Name = oRng.Parent.Parent.Name Then
MsgBox "BINGO"
Debug.Print .Cell(x, y).Shape.Name
Debug.Print "Cell " & CStr(x) & ":" & CStr(y)
End If
Next
Next
End With
Else
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh.Table
For x = 1 To .Rows.Count
For y = 1 To .Columns.Count
If .Cell(x, y).Selected Then
MsgBox "BINGO"
End If
Next
Next
End With
End If
End Sub
> Also, is there a WithEvents statement that I can use to capture a user
> clicking or moving from cell to cell in a table?
Make PPT respond to events
http://www.pptfaq.com/FAQ00004.htm
Changing cells in a PowerPoint table will trigger the selection change event.
If the table came from Word or Excel, then no.
> Thanks!
> Rob
[quoted text clipped - 19 lines]
> > PPTools: www.pptools.com
> > ================================================
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Rob - 31 Oct 2006 21:04 GMT
Works like a champ! Thanks so much for your help!
> > So that seems to work if the cell is actually selected. Is there any way to
> > tell if the cursor is just sitting in the cell, not necessarily selected?
[quoted text clipped - 86 lines]
> PPTools: www.pptools.com
> ================================================
Steve Rindsberg - 31 Oct 2006 22:28 GMT
> Works like a champ! Thanks so much for your help!
My pleasure ... I learned a new trick that I may be able to put to good use shortly.
> > > So that seems to work if the cell is actually selected. Is there any way to
> > > tell if the cursor is just sitting in the cell, not necessarily selected?
[quoted text clipped - 86 lines]
> > PPTools: www.pptools.com
> > ================================================
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================