The information in this article applies to:
SUMMARYThe Microsoft WordBasic FileSaveAs command allows you to save the current file to another file format and/or to another filename. The syntax for the FileSaveAs command is as follows: Word 7.0
Word 6.0
Word 2.x
The following command saves the active document in rich-text format (RTF)
under the name TEST.RTF for Word 2.x or Word 6.0:
To specify a directory other than the current directory, indicate the full
path with the document name parameter.
Note: When you use the FileSaveAs statement in a macro, if an existing file has the same name, it will be automatically overwritten unless it was previously a template. The following six formats are internal to Word for Windows (2.x & 6.0) and can be set using the .Format parameter:
You can specify additional file formats.
The Word ConverterLookup() function returns the appropriate format number for the specified file format. You can specify the file format by using the class name or the format name as it appears in Word 7.0 on-line Help. Search the topic name "Class names of file converters". You can specify the file format in Word 6.0 by using the class name or the format name as it appears in the Save File as Type box in the Save As dialog box (File menu). To save a document to the WordPerfect 5.1 file format and the name "test.wp", use the following WordBasic instructions: Word version 7.0
Word version 6.0
Word version 2.0In Word 2.x, to indicate a format other than the six internal formats you can count the first converter listed under the [MS Text Converters] section as number 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.
To save a document to the WordPerfect 5.1 file format and the name
"test.wp", use either of the following commands based on the WIN.INI
settings above:
MORE INFORMATIONThe following example macro saves the current document to the text file format with a .TXT file extension:
The Left$() command above separates the document name from its file
extension so that the macro can save the document as a text file with a
.TXT extension. InStr() is used to determine the position of the "."
character. Left$() is then used to return all the characters to the left of
the "." character. The FileSaveAs command saves the document in the text-
only format with a .TXT file extension in the active directory. Note:
This sample won't work if the file has not previously been saved.
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, page 208 Additional query words: winword2 word95 File Save Format winword macword word7 word6
Keywords : winword macword |
Last Reviewed: September 21, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |