Using the Office Assistant (Clippit) in Visual Basic
Created | Updated Nov 13, 2006
The Office Assistant (Clippit) is that annoying paperclip in Microsoft Office programs. To control the Office Assistant, you will need a Microsoft Office program with the Office Assistant. You can use Clippit in a computing project, for example instead of a message box, or in a Macro. You will be able to control the Office Assistant using the Visual Basic Editor.
Getting Started
If you are using Clippit in a project, you will probably already have somewhere to put the code. Otherwise, follow these steps to create a new macro for you to work with:
- Click on Tools, Macros and Record New Macro. Give the macro a really nice name, and Click OK
- Click on the Stop (Square) Button
- Click on Tools, Macros and Macros
- Click on Edit
You can swap between editor and main program by pressing Alt+F11.
Animating the Assistant
To animate Clippit, Type:
Assistant.Animation =
At this point, a drop-down list should appear. Select the animation you want from the list. To show the animation either click on the Play button, click on Run, Run Sub, or press F5.
Making the Assistant Speak
Type:
Dim Bln As Balloon
Set Bln = Assistant.NewBalloon
With Bln.Heading = "A heading"
.Text = "Some text"
other options go here (optional)
.ShowEnd With
To show the balloon either: click on the Play button; click on Run, Run Sub; or press F5.
Making Multi-lined Text
Insert:
" + Chr(13) + "
... where needed. For example:
.Heading = "I can write a heading..." + Chr(13) + "An put it on as many lines" + Chr(13) + "As I want!"
This would look like:
I can write a heading...
And put it on as many lines
As I want!
Icon
Type in the other options go here part:
.Icon =
... and select an icon from the list.
Buttons
In the other options here part, type on a separate line:
.Button =
... and select a button set from the list which is displayed.
You can use this information by replacing:
.Show
End With
... with:
Dim r as Integer
End With if r = msoBalloonButtonOK then
r = .ShowInsert your own code here
end if if r = msoBalloonButtonNo thenInsert your own code here
end if
etc
Depending on the button set you used, you can type 'msoBalloonButtonAbort', 'msoBalloonButtonBack', 'msoBalloonButtonCancel', 'msoBalloonButtonClose', '-Ignore', '-Next', '-No', '-OK', '-Options', '-Retry', '-Search', '-Snooze', '-Tips', '-Yes' or '-YesToAll'.
You can also use the numbers 1 - 5 (for results from labels, see below) and 'msoBalloonButtonNull' for when the balloon closes when you click on something else (see balloon mode, below).
Labels
You can use up to five labels to display a bullet list, numbered list or blue option buttons. For each label, type:
.Labels(A number between 1 and 5).Text = "Label Text"
... in the other options go here part.
To choose what type of labels these are, also include:
.BalloonType =
... and select an item from the list.
Checkboxes
Into the other options go here part, type:
.Checkboxes(a number between 1 and 5).Text = "Checkbox text" .Checkboxes(a number between 1 and 5).Checked = True OR False
To use this information, replace:
.Show
... with
.Show
if .Checkboxes(a number between 1 and 5).Checked thenInsert your own code here
end if
if .Checkboxes(a number between 1 and 5).Checked thenInsert your own code here
end if
etc
Balloon Mode
Into the other options go here part, type:
.Mode =
... and select an option.
msoModeAutoDown - Allows you to click away from the balloon to close it
msoModeModal - Default