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

Last reviewed: September 12, 1996
Article ID: Q113840
The information in this article applies to:
  • Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0

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.

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

  2. From the Format menu, choose Object, and set Fill to None. Select OK to accept the change.

  3. 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.

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

  2. From the Format menu, choose Patterns, and set Fill to None. Select OK to accept the change.

  3. 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



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 12, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.