XL: Can't Set Property of Outline Class With Object Selected

Last reviewed: December 1, 1997
Article ID: Q111310
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a

SYMPTOMS

In Microsoft Excel, you may receive the following error message when you run a Microsoft Visual Basic for Applications procedure that changes the property of an Outline object

   Run-time error '1005'

   Unable to set the <property name> property of the Outline class

where <property name> is the property of the Outline class you are changing in the procedure.

CAUSE

Some of the commands you use in a Visual Basic procedure are selection dependent, even when you specify the object name. The above error message appears if you run a procedure to change the property of an Outline when a drawing object or chart object is selected on a worksheet. You can see this visually if you select a drawing object on a worksheet and then choose Group And Outline from the Data menu. Note that the options on the Group And Outline menu are unavailable.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/default.asp

To avoid receiving an error message in a Visual Basic procedure with a command that is selection dependent, make sure your procedure makes the proper selection on the workbook. For example, to change a property of the Outline object without receiving an error message, first make sure that a drawing object or chart object is not selected by selecting a cell on the worksheet, as in the following example.

   Sub Outline_Settings()
      ' Select first cell on worksheet
      Range("A1").Select
      ' Select outline settings
      With ActiveSheet.Outline
         ' Clear AutomaticStyles option
         .AutomaticStyles = False
         ' Select Summary Columns To Right of Detail option
         .SummaryColumn = xlRight
      End With
   End Sub


Additional query words: 5.00
Keywords : kbcode kbprg PgmOthr
Version : WINDOWS:5.0,5.0c,7.0,7.0a; MACINTOSH:5.0,5.0a
Platform : MACINTOSH WINDOWS
Issue type : kbprb
Solution Type : kbworkaround


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