Muokkaa

Jaa


Window.SelectedCell property (Visio)

Returns the selected cell in the ShapeSheet window. Read-only.

Syntax

expression. SelectedCell

expression A variable that represents a Window object.

Return value

Cell

Remarks

The SelectedCell property applies only to ShapeSheet windows. If you try to access the SelectedCell property for any other type of window, Microsoft Visio returns the error message "Invalid window type for this action."

If a ShapeSheet row is selected (instead of a cell), SelectedCell returns Nothing. See the following example.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SelectedCell property to print the name, section, row, column, and formula of the selected ShapeSheet cell in the Immediate window.

Public Sub SelectedCell_Example() 
 
 Dim vsoCell As Visio.Cell 
 
 Set vsoCell = Application.ActiveWindow.SelectedCell 
 
 'If vsoCell is Nothing, a row is probably selected. 
 If (Not vsoCell Is Nothing) Then 
 Debug.Print "Cell Name: " & vsoCell.Name 
 Debug.Print "Section: " & vsoCell.Section 
 Debug.Print "Row: " & vsoCell.Row 
 Debug.Print "Column: " & vsoCell.Column 
 Debug.Print "Formula: " & vsoCell.Formula 
 Else 
 Debug.Print "vsoCell is Nothing--a row is probably selected." 
 
 End If 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.