Showing xlDialogFormatChart Causes Run-Time ErrorLast reviewed: September 2, 1997Article ID: Q136522 |
The information in this article applies to:
SYMPTOMSWhen you use the following line of code in a Visual Basic, Applications Edition, procedure
Application.Dialogs(xlDialogFormatChart).Showyou will receive the following error message:
Run-time error 1004: Show method of Dialog class failed CAUSExlDialogFormatChart 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.
RESOLUTIONThe 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 INFORMATIONThe 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 Dialogand 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |