Callback Property

Applies To

Balloon object.

Description

Sets the name of the procedure to be run whenever a modeless balloon is displayed. Read/write String.

Note If you specify a macro that exists behind an Excel worksheet, you must include the worksheet in the reference, as in "Sheet1.myCallback" instead of "myCallback".

See Also

Balloon object, BalloonCheckbox object, BalloonLabel object, Checked property, Show method.

Specifics (Microsoft Access)

You set the Callback property when you're working with a modeless balloon. A modeless balloon is one that allows the user to switch back to the application in which they're working without first closing the balloon. A modeless balloon may be useful if you're creating help that the user will want to leave open while performing several steps in the application. To make a balloon modeless, set the Mode property of the Balloon object to msoModeModeless.

The Callback property specifies a function or a macro to run when the user clicks a button on a balloon. If you write a function to be called by the Callback property, you can use that function to determine which button was clicked.

You set the Callback property to the name of a function or macro. For example, the following line of code sets the Callback property:

Assistant.NewBalloon.Callback = "EvaluateCheckboxes"
Note that you must set the Callback property to the name of a Function procedure; you can't set it to the name of a Sub procedure. The Function procedure must be public.

Example

This example displays a balloon that contains a selection of three printers. After the user clicks the OK button on the balloon, the ProcessPrinter procedure is run and the balloon is closed.

Sub shar()
Set bln = Assistant.NewBalloon
With bln
    .Heading = "Select a Printer."
    .Text = "Click OK when you've selected a printer."
    .Labels(1).Text = "Network Printer"
    .Labels(2).Text = "Local Printer"
    .Labels(3).Text = "Local Color Printer"
    .BalloonType = msoBalloonTypeButtons
    .Mode = msoModeModeless
    .Callback = "ProcessPrinter"
    .Button = msoButtonSetOK
    .Show
End With
End Sub
(Every procedure specified in the Callback property is passed three arguments: the balloon that activated the procedure, the return value of the button the user pressed, and an integer that uniquely identifies the balloon that called the procedure.)

Sub ProcessPrinter(bln As Balloon, ibtn As Long, Priv As Long)
    Assistant.Animation = msoAnimationPrinting
    Select Case ibtn
    Case 1
        ' Insert printer-specific code
        bln.Close
    Case 2
        ' Insert printer-specific code
        bln.Close
    Case 3
        ' Insert printer-specific code
        bln.Close
    End Select
    End Sub