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.