Setting Default Save As to Microsoft Excel 4.0 File Format

Article translations Article translations
Article ID: 125270 - View products that this article applies to.
This article was previously published under Q125270
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SUMMARY

The following example allows you to save the active worksheet in a Microsoft Excel workbook to the Microsoft Excel 4.0 Worksheet file format by default. Note that this example can easily be modified to save a workbook to any desired file format by default.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to 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 requirements. This example describes a method that allows you to save a worksheet to the Microsoft Excel 4.0 Worksheet file format by default by choosing a menu command. The example involves the following steps:

  • Creating the Procedure
  • Adding the Procedure to a Menu
  • Creating an Add-in from the Procedure

To Create the Procedure

  1. From the Insert menu, choose Macro, and then choose Module.
  2. In the new module, enter the following:
          Sub SaveAsDefault()
             ' Display the Save As Dialog box with Microsoft Excel 4.0
             ' Worksheet selected in the Save File As Type list
             ' The active sheet must be a worksheet or an error is returned
             Application.Dialogs(xlDialogSaveAs).Show ,xlExcel4
          End Sub
    						
Note that in the above procedure, xlExcel4 is the FileFormat property for the Microsoft Excel 4.0 Worksheet file format. You can substitute any FileFormat property for this value to save a file to that specific file format by default.

For a list of the different FileFormat properties that you can use, choose the Search button in the Visual Basic Reference and type:
FileFormat Property

To Add the Procedure to a Menu

  1. In the module that contains the SaveAsDefault procedure, choose Menu Editor from the Tools menu.
  2. From the Menu Bars list, select Worksheet.
  3. From the Menus list, select the menu that you want to add the procedure to, such as &File.
  4. From the Menu Items list, select the menu item above which you want the new menu item added. (A new menu item is added above the selected menu item.) Choose the Insert button.
  5. In the Caption box, type the text that you want to appear on the menu, such as Save As Excel 4.
  6. From the Macro list, select SaveAsDefault. Choose OK.

To Create the Add-in

  1. In the module that contains the SaveAsDefault procedure, choose Make Add-in from the Tools menu.
  2. In the File Name box, enter the name of the add-in, such as XL4.
  3. Choose OK.
NOTE: To have the menu item appear each time you start Microsoft Excel, you can copy this add-in file to the Microsoft Excel STARTUP subdirectory.

In Microsoft Excel for the Macintosh, you can copy the file to the 'Excel Startup Folder (5)' folder located in the System Folder:Preferences folder (System 7.0 or later) or the System Folder (System 6.0).

REFERENCES

For more information about the SaveAs Method, choose the Search button in the Visual Basic Reference and type:
SaveAs Method

Properties

Article ID: 125270 - Last Review: September 13, 2013 - Revision: 2.3
APPLIES TO
  • Microsoft Excel 95 Standard Edition
  • Microsoft Excel 5.0c
  • Microsoft Excel 5.0 Standard Edition
Keywords: 
kbnosurvey kbarchive kbcode kbhowto kbprogramming KB125270

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com