XL98: Problems When Removing Line from Drawing Object

ID: Q183221


The information in this article applies to:
  • Microsoft Excel 98 Macintosh Edition


SYMPTOMS

In Microsoft Excel 98 Macintosh Edition, if you use a Visual Basic for Applications macro to remove the border line from a drawing object or AutoShape, one of the following problems may occur:

  • The interior of the object may change color, switch to a different pattern, or turn completely transparent.


  • -or-

  • You may receive the following error message
    Run-time error '1004':
    Unable to set the LineStyle property of the Border class
    and your macro halts.



CAUSE

These problems may occur if you try to use either of the following lines of code to remove the border line from a drawing object, such as a rectangle or an oval:


   Selection.Border.LineStyle = xlNone 
-or-

   Selection.Border.LineStyle = xlLineStyleNone 


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 professionals 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/overview/overview.asp
In Microsoft Excel 98 Macintosh Edition, use the following line of code to remove the border line from a drawing object:

   Selection.ShapeRange.Line.Visible = msoFalse 


STATUS

This behavior is by design of Microsoft Excel 98 Macintosh Edition.


MORE INFORMATION

In Microsoft Excel 98 Macintosh Edition, drawing objects such as rectangles, ovals, and freehand objects can be filled with a variety of effects, including solid colors, gradient fills, patterns, textures, and pictures.

If you run either of the commands in the "Cause" section, the commands may not work correctly. The results you receive depend on the kind of fill that is applied to the object from which you are removing the line. These results are listed in the following table.


    Fill type     Results
   ------------------------------------------------------------------------

   Solid Color   The line is removed correctly.

   Gradient      You receive the "Run-time error '1004'" error message,
                 and the line is NOT removed.

   Pattern       The line is removed correctly, but the pattern may be
                 replaced by another, different pattern.

   Texture       The line is removed correctly, but the texture fill is
                 removed and replaced with a solid white fill.

   Picture       The line is removed correctly, but the picture fill is
                 removed completely so that the object is transparent. 
To work around these problems, use the line of code in the "Workaround" section whenever you want to remove the border line from a drawing object.

Additional query words: XL98

Keywords : kbprg kbdta xlvbahowto xldraw
Version : MACINTOSH:98
Platform : MACINTOSH
Issue type : kbhowto


Last Reviewed: November 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.