Visible Property

Microsoft Word Visual Basic

Show All

Visible Property

       

Visible property as it applies to the FillFormat, LineFormat, ShadowFormat, Shape, ShapeRange, and ThreeDFormat objects.

True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse
msoTriStateMixed
msoTriStateToggle
msoTrue

expression.Visible

expression   Required. An expression that returns one of the above objects.

Visible property as it applies to the Application, Border, Reviewer, Task, TaskPane, and Window objects.

True if the specified object is visible. Read/write Boolean.

expression.Visible

expression   Required. An expression that returns one of the above objects.

Remarks

For any object, some methods and properties may be unavailable if the Visible property is False.

Example

As it applies to the Application object.

This example hides Microsoft Word.

Application.Visible = False

As it applies to the Task object.

This example hides the Calculator, if it's running. If it's not running, a message is displayed.

If Tasks.Exists("Calculator") Then
    Tasks("Calculator").Visible = False
Else
    Msgbox "Calculator is not running."
End If

As it applies to the Border object.

This example creates a table in the active document and removes the default borders from the table.

Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
    NumRows:=12, NumColumns:=5)
For Each aBorder In myTable.Borders
    aBorder.Visible = False
Next aBorder

As it applies to the Shape object.

This example hides the shadow formatting for the first shape in the active document.

ActiveDocument.Shapes(1).Shadow.Visible = False

This example creates a new document and then adds text and a rectangle to it. The example also sets Word to hide the rectangle while the document is being printed and then to make it visible again after printing is completed.

Set myDoc = Documents.Add
Selection.TypeText Text:="This is some sample text."
With myDoc
    .Shapes.AddShape msoShapeRectangle, 200, 70, 150, 60
    .Shapes(1).Visible = False
    .PrintOut
    .Shapes(1).Visible = True
End With