Microsoft KB Archive/96745

= Microsoft Knowledge Base =

Excel: Macro to Set Preferred Chart Type when Document Opened
Last reviewed: September 12, 1996

Article ID: Q96745

The information in this article applies to:


 * Microsoft Excel for Windows, version 3.0
 * Microsoft Excel for the Macintosh, version 3.0
 * Microsoft Excel for OS/2, version 3.0

SUMMARY
To set chart preferences for a session of Microsoft Excel, open a chart that contains the characteristics you want to use as defaults and choose the Set Preferred command from the Gallery menu. This command sets the default for the following attributes to be the same as those of the open chart:


 * The type of chart
 * The displayed chart colors
 * The font for the chart labels

The preferred chart is not saved when you quit Microsoft Excel, but you can use an add-in macro to reset the preferred chart each time Microsoft Excel is opened.

MORE INFORMATION
In versions of Microsoft Excel prior to 4.0, you cannot use chart templates to set the preferred chart type. To set the preffered chart type you need to use a macro.

To create a macro to set the preferred chart:


 * 1) Create or open the preferred chart. Save this chart and close it. Close all other open Microsoft Excel files.
 * 2) From the Macro menu, choose Record. Name the macro &quot;auto_open&quot; (without the quotation marks). (If you are using Microsoft Excel version 4.0, choose the Store Macro In Macro Sheet option.) Choose the OK button.
 * 3) Open the chart. If the message &quot;Update Links to Unopened Documents?&quot; appears, choose the Yes button.
 * 4) From the Gallery menu, choose Set Preferred.
 * 5) Close the chart without saving your changes. If you would like a new worksheet to be opened each time you start Microsoft Excel, choose New from the File menu, choose Worksheet, and choose the OK button.
 * 6) From the Macro menu, choose Stop Recorder. From the Window menu, choose the name of the macro sheet that the macro was recorded to.
 * 7) Change the line that reads =CLOSE to =CLOSE(FALSE). If you are using Microsoft Excel version 4.0, change the line =FILE.CLOSE to =FILE.CLOSE(FALSE). This will prevent the message &quot;Save changes to &quot; from appearing when the macro closes the chart.
 * 8) To keep the screen from being redrawn, insert a line that reads =ECHO(FALSE) directly below the name of the macro.
 * 9) From the File menu, choose Save As and select Add-In under File Type. Change the directory to XLSTART (if you are using Microsoft Excel for Windows) or change the folder to the &quot;Excel Startup Folder&quot; (if you are using Microsoft Excel for the Macintosh). Give the file a name and save it.

The next time you open Microsoft Excel, the macro will open your chart, set the preferred type, and close the chart.

In Microsoft Excel version 4.0, the ChartWizard will not use the preferred chart format. To create an embedded chart with the preferred settings, use the Preferred Chart tool (the chart with a hand above it) on either the Microsoft Excel version 3.0 toolbar or the Chart toolbar.

Microsoft provides macro 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.