XL97: Cannot Use xlDisplayShapes with DisplayDrawingObjects

ID: Q163741

The information in this article applies to:

SYMPTOMS

When you run a Visual Basic for Applications macro that refers to the DisplayDrawingObjects property of Microsoft Excel 97, you may receive the following error message:

   Compile error:
   Type mismatch

CAUSE

This problem occurs when your macro contains a line of code that is similar to the following:

   ActiveWorkbook.DisplayDrawingObjects = xlDisplayShapes

WORKAROUND

To prevent this problem from occurring, use the constant xlAll instead of the constant xlDisplayShapes. For example, change the sample line of code to the following:

   ActiveWorkbook.DisplayDrawingObjects = xlAll

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

NOTE: The information that is in the Help topic for the DisplayDrawingObjects property is incorrect.

MORE INFORMATION

In Microsoft Excel, use the DisplayDrawingObjects property to determine how drawing objects are displayed in a workbook. You can use the following constants when you set the DisplayDrawingObjects property.

   Constant         Description
   --------------------------------------------------------------------

   xlAll            Show all shapes
   xlPlaceholders   Show placeholders for each shape
   xlHide           Hide all shapes

In Microsoft Excel 97, the Help topic for DisplayDrawingObjects indicates that you can use the constant xlDisplayShapes instead of the constant xlAll. This information is incorrect.

Additional query words: 97 XL97

Keywords          : kberrmsg kbprg kbdocerr kbdta KbVBA 
Version           : WINDOWS:97
Platform          : WINDOWS

Last Reviewed: January 7, 1999