Drawing Object Coordinates Depend on Zoom Factor

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

SYMPTOMS

In Microsoft Excel versions 4.0 and 4.0a, if you turn on the macro recorder, and you use the tools on the Drawing toolbar to draw an object such as a line or polygon, when you run the macro, the size and position of the drawing depends on the zoom factor of the active sheet.

CAUSE

The CREATE.OBJECT() macro function has the following arguments (coordinates) that describe how to draw an object: ref1, x_offset1, y_offset1, ref2, x_offset2, y_offset2.

In Microsoft Excel versions 4.0 and 4.0a, when you use the CREATE.OBJECT() macro function to create a drawing object on a worksheet, the coordinates that you use create a different-sized object depending on the zoom factor of the worksheet.

Additionally, when you record a macro that uses the CREATE.OBJECT() macro function, the coordinates of the created object depend on the zoom factor of the worksheet. For example, if you turn on the macro recorder, and draw a horizontal line on a worksheet with a magnification factor of 100 percent, and you then draw the same horizontal line on a worksheet with a magnification factor of 200 percent, the x_offset1 and the y_offset2 values recorded for the line at 200 percent are twice those recorded at 100 percent.

WORKAROUND

To work around this behavior when you use a macro to create a drawing object on a worksheet, make sure the worksheet has the same magnification factor when you run the macro as when you created the macro. You can use the ZOOM() function in your macro before you create the object to make sure that the worksheet is at the desired magnification factor. For example, the following command restores the active worksheet to 100-percent magnification:

   =ZOOM(FALSE)

STATUS

This problem has been corrected in Microsoft Excel version 5.0. In Microsoft Excel version 5.0, the size of an object created on a worksheet using a macro is independent of the zoom factor of the worksheet.

MORE INFORMATION

For more information about using a macro to create an object on a zoomed worksheet, query on the following words in the Microsoft Knowledge Base:

   zoom and position and macro and recorded


KBCategory:
KBSubcategory:

Additional reference words: 4.00 4.00a 5.00 different relative absolute



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.