Activate Event

The ActivateEvent event handler enables you to take action when the document is activated. For example, you might want to ensure that the Shared Workspace task pane is always visible whenever your VSTO solution is activated, as the code in Listing 6.35 demonstrates.

Listing 6.35. Displaying the Shared Workspace task pane whenever a document is activated

Private Sub ThisDocument_ActivateEvent(ByVal sender As _ Object, ByVal e As Microsoft.Office.Tools.Word _ .WindowEventArgs) Handles Me.ActivateEvent

Application.TaskPanes(Word.WdTaskPanes. _

wdTaskPaneSharedWorkspace). Visible = True

End Sub

0 0

Post a comment