Hack 12 Hack the Office Assistant![]() ![]() annoying computer help characteron a short leash with the techniques shown in this hack.Ironically, the Office Assistant can be one of the more difficult features to manage in Word. But the Assistant can also be a powerful way to deliver a message to the user of a macro. The following examples take sort of an aikido approach: turning the power of its irritation to a positive end. 2.11.1 Banishing the AssistantAmong the more common reactions to the Assistant are requests to get rid of the wretched thing, immediately and permanently. So for many users, including the following line of code in an AutoExec macro [Hack #60] is the quickest way to a Clippit-free life: Assistant.On = False 2.11.2 Finding a Sympathetic CharacterYou can switch from one Office Assistant character to another even more easily via VBA than via the Office Assistant's interface. To change characters, use the Filename property of the Assistant object: Assistant.Filename = "OffCat.acs"The quickest way to run this one-liner is from the Immediate window of the Visual Basic Editor [Hack #2], as shown in Figure 2-33. Figure 2-33. Changing the Assistant character from the Immediate window![]() Office and the characters installed. Check the C:\Program Files\Microsoft Office\<Version> folder for .acs files (Microsoft Agent Character files). The name of the last folder, <Version>, depends on the version of Office involvedfor example, OFFICE11 is typical for Office 2003.Your selection may vary, but a list of the usual suspects for a typical installation follows:F1.acsCLIPPIT.acsDOT.acsROCKY.acsOFFCAT.acsMNATURE.acsLOGO.acs 2.11.3 Invoking InvisibilityThe Office Assistant just lurks in the background until you make a mistake that triggers its appearance. You can toggle the Office Assistant's visibility by setting its Visible property to True or False: Assistant.Visible = TrueYou'll need to make sure the Assistant is turned on (Assistant.On = True) before you make it visible. Making the Assistant visible doesn't automatically turn it on. Again, you can quickly make this change from the Immediate window, as described above. 2.11.4 Getting the User's AttentionThe Office Assistant usually appears (if currently hidden) or plays an animation (if displayed, but ignored) to get your attention. To play an animation, use Assistant.Animation. You can select animationsmsoAnimationAppear, msoAnimationEmptyTrash, msoAnimationRestPose, and msoAnimationSearchingfrom the auto-complete list provided by the Visual Basic Editor.The following code summons the Assistant for delivering an urgent message: Assistant.Animation = msoAnimationGetAttentionMajor 2.11.5 Displaying Information and Presenting ChoicesTo display information and present choices to the user, you use a balloon from the Office Assistant.The following code displays the Assistant as shown in Figure 2-34. By checking the state of the Assistant before displaying the message, the macro can decide whether or not to turn off the Assistant after it finishes. Figure 2-34. Use the Office Assistant to present information and straightforward choices from within a macro![]() Sub OA_CheckForMktngTemplate( )You can display your message using a variety of balloons, icons, and buttons, as detailed in the following tables.Table 2-1 lists the types of balloons you can display.
in the balloon, use the following properties:Heading Displays a heading at the top of the balloon. You can use only one heading. Text Displays a single paragraph of text. Labels(n).Text Displays a bulleted or numbered paragraph, depending on the balloon type. Table 2-2 lists the six icons you can display with the balloon (you can also display no icon).
dismissing the dialog.
|