Sub OpenBalloon()
Dim offBalloon As Office.Balloon
Set offBalloon = Application.Assistant.NewBalloon
With offBalloon
' Show the Office Assistant.
.Parent.Visible = True
' Set the heading and text of the balloon.
.Heading = "Welcome to the Microsoft Office 2000 Assistant!"
.Text = "Click one or more of the check boxes below, and " _
& "also click either a label or a button."
' Make the balloon modeless.
.Mode = msoModeModeless
' Display the Back, Next, and Close Buttons.
' To determine the constants for other buttons you can place
' on a balloon, view the Microsoft Office 9.0 Object library
' in the Object Browser.
.Button = msoButtonSetBackNextClose
' Display two labels.
.Labels(1).Text = "First Label"
.Labels(2).Text = "Second Label"
' Display two check boxes.
.Checkboxes(1).Text = "First Checkbox"
.Checkboxes(2).Text = "Second Checkbox"
' Define which Callback procedure to run.
.Callback = "WhichButton"
.Show
End With
End Sub
Sub WhichButton(bln As Balloon, iBtn As Long, iPriv As Long)
Dim cBox As Office.BalloonCheckbox
Dim intCBCount As Integer
Dim strCBMessage As String
bln.Close
intCBCount = 0
For Each cBox In bln.Checkboxes
If cBox.Checked Then
If cBox.Item = "First Checkbox" Then intCBCount = intCBCount + 1
If cBox.Item = "Second Checkbox" Then intCBCount = intCBCount + 2
End If
Next
Select Case intCBCount
Case 1
strCBMessage = "You selected the first checkbox."
Case 2
strCBMessage = "You selected the second checkbox."
Case 3
strCBMessage = "You selected both checkboxes."
Case Else
strCBMessage = "You didn't select a checkbox."
End Select
MsgBox strCBMessage, vbOKOnly, "Callback Test Result"
Select Case iBtn
Case 1
MsgBox "You clicked the first label", vbOKOnly, "Callback Test Result"
Case 2
MsgBox "You clicked the second label", vbOKOnly, "Callback Test Result"
Case msoBalloonButtonBack
MsgBox "You clicked the Back button", vbOKOnly, "Callback Test Result"
Case msoBalloonButtonClose
MsgBox "You clicked the Cose button", vbOKOnly, "Callback Test Result"
Case msoBalloonButtonNext
MsgBox "You clicked the Next button", vbOKOnly, "Callback Test Result"
End Select
End Sub