Showing xlDialogFormatChart Causes Run-Time Error

Last reviewed: September 2, 1997
Article ID: Q136522
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for Windows 95, version 7.0

SYMPTOMS

When you use the following line of code in a Visual Basic, Applications Edition, procedure

   Application.Dialogs(xlDialogFormatChart).Show

you will receive the following error message:

   Run-time error 1004: Show method of Dialog class failed

CAUSE

xlDialogFormatChart is the equivalent of clicking Options in the Format Chart Type dialog box. The Application.Dialog show method is the Microsoft Excel 5.0 Visual Basic for Applications equivalent to the Microsoft Excel 4.0 macro (XLM) command FORMAT.CHART?(1). If the XLM command requires one or more arguments, then so does the Visual Basic for Applications method.

RESOLUTION

The following Visual Basic for Applications code produces the results as intended by using the Application.Dialogs(xlDialogFormatChart).Show.

NOTE: This code assumes that you have an embedded chart named "Chart 1" on a worksheet.

Microsoft provides examples of Visual Basic procedures 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 Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

   Sub FormatGroup()
      'Select the actual chart.
      ActiveSheet.DrawingObjects("Chart 1").Select
      'Activate the chart.
       ActiveSheet.ChartObjects("Chart 1").Activate
      'Show the dialog box
      Application.Dialogs(xlDialogFormatChart).Show 1
   End Sub

MORE INFORMATION

The Application.Dialog Show method follows the interactive XLM command (in this case =FORMAT.CHART?(1)). If the XLM command requires one or more arguments, then so does the Visual Basic for Applications method.

For more information about "Built-In Dialog Box Argument Lists," click the Index tab in Help, type the following text

   Built-In Dialog

and then double-click the selected text to go to the "Built-In Dialog Box Argument Lists" topic.

REFERENCES

"Visual Basic User's Guide," version 5.0, Chapter 11, "Controls and Dialog Boxes," page 234


Additional query words: 5.00 5.00c 7.00
Keywords : kbprg PgmOthr kbcode kbmacro
Version : 5.00 5.00c 7.00
Platform : WINDOWS


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