Partager via


Window.Activate Method

Visio Automation Reference

Activates a window.

Version Information
 Version Added:  Visio 2.0

Syntax

expression.Activate

expression   An expression that returns a Window object.

Return Value
Nothing

Remarks

Microsoft Office Visio can have more than one window open at a time; however, only one window is active. Activating a window can change the objects returned by the ActiveWindow, ActivePage, and ActiveDocument properties.

Example
The following macro creates two windows and then shows how to activate one of the windows.

Visual Basic for Applications
  Public Sub Activate_Example()
Dim vsoDocument As Visio.Document 
Dim vsoWindow As Visio.Window 
 
'Create two new windows by adding documents.
Set vsoDocument = Documents.Add("") 
Set vsoWindow = ActiveWindow 
Set vsoDocument = Documents.Add("") 

'Use the Activate method to make the first
'window created the active window.
vsoWindow.Activate

End Sub

See Also