XL97: Recorded Macro Contains DrawingObjects Method

Last reviewed: March 13, 1998
Article ID: Q163011
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

When you record a Visual Basic for Applications macro in Microsoft Excel 97, the hidden DrawingObjects method is recorded in your macro. Specifically, the following line of code is recorded:

   ActiveSheet.DrawingObjects.Select

CAUSE

This behavior occurs when you record a macro in which you select all of the objects in a worksheet.

Although the DrawingObjects method is hidden in Microsoft Excel 97, it provides the same functionality that it does in earlier versions of Microsoft Excel. If you select all the objects in a worksheet while recording a macro, the recorded code uses the DrawingObjects method instead of the Shapes collection.

WORKAROUND

If you prefer to use the Shapes collection instead of the DrawingObjects method, replace the line of recorded code. To do this, search the macro for the following code:

   ActiveSheet.DrawingObjects.Select

Replace this code with the following code:

   ActiveSheet.Shapes.SelectAll

Both lines of code are functionally identical.

STATUS

This behavior is by design of Microsoft Excel 97.

MORE INFORMATION

In Microsoft Excel 97, you can select all the drawing objects in a worksheet by using the following steps:

  1. On the Edit menu, click Go To.

  2. In the Go To dialog box, click Special.

  3. In the Go To Special dialog box, click Objects, and then click OK.

All of the objects in the worksheet are selected.

If you perform these steps while recording a Visual Basic macro, the recorded code uses the older DrawingObjects method instead of the newer Shapes collection. This does not present a problem when you run the recorded code.


Additional query words: 97 XL97
Keywords : kbcode vbappcode
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbbug


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: March 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.