Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Drawing Objects Behave Differently When Clicked


View products that this article applies to.

Symptoms

If you press ALT, and then click a drawing object, a Visual Basic for Applications macro that is assigned to the drawing object does not run. Instead, the drawing object is selected.

↑ Back to the top


Cause

Clicking a drawing object or an AutoShape behaves differently in Microsoft Excel 97 and Microsoft Excel 2000 than it does in versions earlier than Microsoft Excel 97.

This behavior is by design of Microsoft Excel.

↑ Back to the top


More information

Assigning a Macro

In Microsoft Excel, you can assign a macro to a drawing object or an AutoShape. When you click the drawing object or AutoShape, the assigned macro runs. To assign a macro to a drawing object, follow these steps:

  1. Right-click the drawing object. On the shortcut menu, click Assign Macro.
  2. In the Assign Macro dialog box, click a macro in the list of macros.

    -or-

    Type the name of the macro in the Macro Name/Reference box, and then click OK.

Clicking a Drawing Object

After you assign a macro to a drawing object or an AutoShape, you can run the macro by clicking the object. If no macro is assigned to the drawing object, clicking the drawing object selects it.

Right-Clicking a Drawing Object

If you right-click a drawing object or an AutoShape, a shortcut menu appears. The shortcut menu contains menu commands that pertain to the drawing object. If you then press ESC, the drawing object remains selected. If a macro is assigned to the drawing object, it does not run.

Pressing ALT

In versions of Microsoft Excel earlier than Excel 97, you can run the macro that is assigned to a drawing object by pressing ALT and clicking the drawing object. In Microsoft Excel 97, doing this selects the drawing object but does not run the macro.

Pressing CTRL

In all versions of Microsoft Excel, you can select a drawing object or an AutoShape by pressing CTRL and clicking the drawing object.

Pressing SHIFT

In all versions of Microsoft Excel, if no macro is assigned to a drawing object, you can select it by pressing SHIFT and clicking the drawing object. If a macro is assigned to the drawing object, pressing SHIFT while clicking the drawing object runs the macro.

↑ Back to the top


Keywords: KB159960, kbprogramming, kbprb, kbfea

↑ Back to the top

Article Info
Article ID : 159960
Revision : 6
Created on : 10/10/2006
Published on : 10/10/2006
Exists online : False
Views : 395