Microsoft KB Archive/161014

= ACC97: How to Animate the Office Assistant =

Article ID: 161014

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q161014





SUMMARY
Moderate: Requires basic macro, coding, and interoperability skills.

There may be times when you would like to animate the movements of the Office Assistant in response to actions performed in your application. For instance, you may want to have the Assistant appear when you open a particular form. Or you may want the Assistant to react when a certain event is triggered. This article shows you how to do so.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual.

NOTE: A demonstration of the techniques used in this article can be seen in the sample file, FrmSmp97.exe. For information about how to obtain this sample file, please see the following article in the Microsoft Knowledge Base:

175066 ACC97: Microsoft Access 97 Sample Forms Available in Download Center



MORE INFORMATION
The following example creates three event procedures that control the behavior of the Clippit Assistant. The first procedure selects Clippit and makes the Assistant visible when the Employees form is opened. The second procedure instructs Clippit to simulate listening to the computer when a field is updated. The third procedure closes the Assistant when the form is closed and resets some of the properties of the Assistant.

CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database.

NOTE: This example assumes you have the Clippit Assistant (Clippit.act) installed on your computer. By default the Assistants are installed in the C:\Program Files\Microsoft Office\Office\Actors\ folder.

Starting the Assistant
 Open the sample database Northwind.mdb. Open the Employees form in Design view.  Set the OnOpen property of the form to the following event procedure.

NOTE: The following sample code requires that you have a reference to the Microsoft Office 8.0 Object Library in your database. To create the reference, open any module in Design view, click References on the Tools menu, and then click the Microsoft Office 8.0 Object Library. Private Sub Form_Open(Cancel As Integer) With Assistant .Filename = "Clippit.act" ' Returns or sets the name of the ' active Office Assistant. .Visible = True .Animation = msoAnimationGreeting  ' Simulates greeting user. .Sounds = True .SearchWhenProgramming = True .FeatureTips = True End With End Sub  Close the Module window.

Changing the Movement of the Assistant
  Set the AfterUpdate property of the FirstName text box to the following event procedure: Private Sub FirstName_AfterUpdate With Assistant .Animation = msoAnimationListensToComputer ' Animates ' Assistant. End With End Sub </li> Close the Module window.</li></ol>

Closing the Assistant When the Form Closes
  Set the OnClose property of the form to the following event procedure: Private Sub Form_Close If Assistant.Visible = True Then With Assistant .AssistWithHelp = False .SearchWhenProgramming = False .GuessHelp = False .FeatureTips = False .Visible = False End With End If     End Sub </li> Close the Module window.</li> Save the form, and then open it in Form view. Note that the Powerpup Assistant is displayed.</li> Type a new name in the First Name field and press ENTER. Note that the Powerpup Assistant responds with "listening" animation.</li> Close the form. Note that the Clippit Assistant closes.</li></ol>

<div class="references_section">