XL5: Polygon with Attached Macro Changes When Fill Set to None

ID: Q113840

4.00 4.00a 5.00 WINDOWS kbusage kbtool

The information in this article applies to:

SUMMARY

In Microsoft Excel, you can assign a macro to a graphic object so that the macro will run whenever you click the object. However, if the macro is assigned to an unfilled polygon, the macro can only be run by clicking on the border (outline) of the polygon. This is by design.

MORE INFORMATION

Steps to Reproduce Behavior

In version 5.0:

1. Use the drawing tools to create a filled (solid) polygon on a new

   worksheet. (To display the drawing tools, choose Toolbars from the
   View menu. Select Drawing from the list of toolbars, then choose
   OK.)

2. In a Visual Basic module, enter the following macro:

     Sub Message_Box()
        MsgBox "This is a test!"
     End Sub

3. To assign the macro to the polygon, do the following:

   a. In the worksheet, select the polygon, and choose Assign Macro from
      the Tools menu.

   b. Select "Message_Box" from the list of available macros, and choose
      the OK button.

4. To turn off drawing selection mode, choose the Drawing Selection button
   on the Drawing toolbar.

5. Click another cell on the worksheet so that the polygon is no longer
   selected.

6. Run the macro by clicking the polygon.

The "This is a test!" message box will appear.

7. Press and hold down the CTRL key and click the polygon.

8. From the Format menu, choose Object, and set Fill to None. Select OK to

   accept the change.

9. Click another cell on the worksheet so that the polygon is no longer
   selected.

You will no longer be able to activate the macro by clicking inside the polygon (it can only be activated by clicking the outline).

In version 4.0:

1. Use the drawing tools to create a filled (solid) polygon on a new

   worksheet. To display the drawing tools, choose Toolbars from the
   Options menu. Select Drawing from the list of toolbars, then choose
   Show.

2. On a new macro sheet, enter the following commands:

      A1: =ALERT("This is a test!")
      A2: =RETURN()

3. To assign the macro to the polygon:

   a. Select the polygon.

   b. From the Macro menu, choose Assign to Object.

   c. Enter a cell reference to the first cell of the macro, and choose the
      OK button.

4. Click another cell on the worksheet so that the polygon is no longer
   selected.

5. To run the macro, click the polygon.

The alert box will appear.

6. Press and hold down the CTRL key, and click the polygon.

7. From the Format menu, choose Patterns, and set Fill to None. Select OK

   to accept the change.

8. Click another cell on the worksheet so that the polygon is no longer
   selected.

You will no longer be able to activate the macro by clicking inside the polygon (it can only be activated by clicking the outline).

REFERENCES

"User's Guide," version 5.0, pages 230, 637 "User's Guide 1," version 4.0, page 509

KBCategory: kbusage kbtool KBSubcategory:

Additional reference words: 4.00 4.00a 5.00 assigning

Version           : 4.00 4.00a 5.00
Platform          : WINDOWS

Last Reviewed: September 14, 1996