Поделиться через


Application.IsValidObject Method (Publisher)

Determines whether the specified object variable references a valid object and returns a Boolean value: True if the specified variable that references an object is valid, False if the object referenced by the variable has been deleted.

Syntax

expression .IsValidObject(Object)

expression A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

Object

Required

Object

A variable that references an object.

Return Value

Boolean

Example

This example formats the line of a valid object.

Sub ValidShape(shpObject As Shape) 
 
 If Application.IsValidObject object:=shpObject) = True Then 
 With shpObject.Line 
 .DashStyle = msoLineRoundDot 
 .ForeColor.RGB = RGB(Red:=158, Green:=50, Blue:=208) 
 .Weight = 5 
 End With 
 End If 
 
End Sub

Use the following subroutine to call the above subroutine.

Sub CallValidShape() 
 Call ValidShape(shpObject:=ActiveDocument.Pages(1).Shapes(2)) 
End Sub

See Also

Concepts

Application Object Members

Application Object