WD: Modifying FileSaveAs to Use Different Default Format

ID: Q90751


The information in this article applies to:
  • Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a


SUMMARY

In Word 7.x and earlier, you can change the default file format selected in the Save As dialog box by modifying the FileSaveAs macro. The "More Information" section of this article discusses how to do this for each version of Word.

NOTE: Beginning with Word 97 for Windows or Word 98 Macintosh Edition you can set the file format that Word uses by default each time you save a document. To do this, click Options (Preferences in Word 98 Macintosh Edition) on the Tools menu, click the Save tab, and select the file format you want from the Save Word Files As drop-down list.


MORE INFORMATION

When you click Save As on the File menu, Normal file format is selected by default. To change this selection, modify the global FileSaveAs macro by setting the Format argument to a specific number that corresponds to the desired default file format as follows.

Word 7.x

Word version 7.x includes a function called ConverterLookup that returns a number corresponding to a specified converter. The number returned by ConverterLookup can be used with FileSaveAs to specify a different format.

   Sub MAIN
      Dim dlg As FileSaveAs
      GetCurValues dlg
      x = ConverterLookup("Word 2.x for Windows")
      dlg.Format = x
      n = Dialog(dlg)
      If n = -1 then FileSaveAs dlg
   End Sub 
NOTE: "Word 2.x for Windows" is the name of the file format as it appears in the Save File As Type box in the Save As dialog box (File menu).

NOTE: The ConverterLookup() method described above, can also be used with Word 6.0 for the Macintosh. For example, the following macro instructions save the current document as Test in the stationery file format.

   x = ConverterLookup("Stationery")
   FileSaveAs .Name = "Test" , .Format = x 

Word 6.x

Word version 6.x for Windows includes a function called ConverterLookup that returns a number corresponding to a specified converter. The number returned by ConverterLookup can be used with FileSaveAs to specify a different format.

   Sub MAIN
      Dim dlg As FileSaveAs
      GetCurValues dlg
      x = ConverterLookup("Word for Windows 2.0")
      dlg.Format = x
      n = Dialog(dlg)
      If n = -1 then FileSaveAs dlg
   End Sub 
NOTE: "Word for Windows 2.x" is the name of the file format as it appears in the Save File As Type box in the Save As dialog box (File menu).

NOTE: The ConverterLookup() method described above, can also be used with Macintosh Word 6.x. For example, the following macro instructions save the current document as Test in the stationery file format.

   x = ConverterLookup("Stationery")
   FileSaveAs .Name = "Test" , .Format = x 

Word 2.x


   Sub MAIN
      Dim dlg As FileSaveAs
      GetCurValues dlg
      dlg.Format = N '(number corresponding to the Format argument)
      n = Dialog(dlg)
      If n = - 1 Then FileSaveAs dlg
   End Sub 
To indicate a file format other than the six internal formats, you can count the first converter listed under the [MSWord TextConverters] section as either 7 or 100 and then count down the list. For example, based on the following WIN.INI settings, the WordPerfect 5.1 converter can be counted as format 103 or 10:

   [MSWord Text Converters]
   DOS Text with Layout-DOS Text with Layout, C:\WINWORD\TXTWLYT.CNV, asc
   Text with Layout-Text with Layout, C:\WINWORD\TXTWLYT.CNV, ans
   WrdPrfctDOS50-WordPerfect 5.0, C:\WINWORD\WPFT5.CNV, doc
   WrdPrfctDOS-WordPerfect 5.1, C:\WINWORD\WPFT5.CNV, doc
   MSWordWin-Word for Windows 1, C:\WINWORD\WORDWIN1.CNV, doc 
To save a document to the Word for Windows 1.x file format by default, set the .Format parameter to 104 or 11 (based on the above WIN.INI settings) as follows:

   Sub MAIN
      Dim dlg As FileSaveAs
      GetCurValues dlg
      dlg.Format = N '(number corresponding to the Format argument)
      n = Dialog(dlg)
      If n = - 1 Then FileSaveAs dlg
   End Sub 
The following six formats are internal to Word for Windows and can be set using the .Format parameter:

   0  Normal (Word format).

   1  Document Template.

   2  Text Only (extended characters saved in ANSI character set).

   3  Text+Breaks (plain text with line breaks; extended characters saved
      in ANSI character set).

   4  Text Only (PC-8) (extended characters saved in IBM PC character
      set).

   5  Text+Breaks (PC-8) (text with line breaks; extended characters
      saved in IBM PC character set).

   6  Rich Text Format (RTF). 


REFERENCES

"Microsoft Word for Windows and OS/2 Technical Reference," 177-178 "Using WordBasic," by WexTech Systems and Microsoft, page 208

Additional query words: winword2 winword macword 7.0 word7 word6 word95 6.0 File Save 2.0 filesave word97

Keywords : kbmacro
Version : MACINTOSH:6.0,6.0.1,6.0.1a; WINDOWS:2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a
Platform : MACINTOSH WINDOWS
Issue type :


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