Excel

Control the Office Assistant

Ease of Use

Hard

Version tested with

2002 

Submitted by:

Jacob Hilderbrand

Description:

This macro demonstrates how to use the Office Assistant with VBA. 

Discussion:

You want to use the Office Assistant in your VBA code. This macro demonstrates how to do just that. Note: The Office Assistant must be enabled for this to work, though it doesn't have to be visible. 

Code:

instructions for use

			

Option Explicit Sub OfficeAssistant() With Assistant .Visible = True With .NewBalloon .Heading = "How can I help you?" .Labels(1).Text = "I'm tired" .Labels(2).Text = "I have too much homework" .Labels(3).Text = "I want to play a game" .BalloonType = msoBalloonTypeButtons .Button = msoButtonSetNone .Mode = msoModeModeless .Callback = "Response" .Show End With End With End Sub Sub Response(bln As Balloon, lbtn As Long, lPriv As Long) bln.Close Select Case lbtn Case Is = 1 MsgBox "Well then go to sleep.", vbInformation Case Is = 2 MsgBox "So, why are you talking to me? Get to work.", vbCritical Case Is = 3 MsgBox "Go to this site: http://www.vbaexpress.com/forum/arcade.php? ", vbInformation End Select End Sub

How to use:

  1. Open Excel.
  2. Alt + F11 to open the VBE.
  3. Insert | Module.
  4. Paste the code there.
  5. Close the VBE (Alt + Q or press the X in the top right corner).
 

Test the code:

  1. Tools | Macro | Macros...
  2. Select OfficeAssistant and press Run.
 

Sample File:

Office Assistant.ZIP 6.49KB 

Approved by mdmackillop


This entry has been viewed 196 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express