Article ID: 209186 - View products that this article applies to.
This article has been archived. It is offered "as is" and will no longer be updated.
The SaveAs method of the Document object in Microsoft Visual Basic for Applications has an optional parameter called FileFormat that you can use to specify the save format for the document.
This article describes how to use the FileFormat property of the SaveAs method to specify a converter that is not supported with one of the supplied constants (values).
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.
For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:
212536The FileFormat optional variant (argument) specifies the format in which the document is to be saved and can be one of the following native (built-in) wdSaveFormat constants.
(https://support.microsoft.com/kb/212536/EN-US/ )OFF2000: How to Run Sample Code from Knowledge Base Articles
Other File TypesIf you record a macro that saves a file as a type that is not supported by one of the constants described earlier, the FileFormat property will contain a number. The following sample macro was recorded by using RFT-DCA as the Save As Type:
NOTE: The number 101 that was recorded for the RTF-DCA FileFormat argument is system specific. This number may not be the same on another computer.
To retrieve the correct FileFormat number for a conversion type for any computer, use the FileConverters collection. The following sample Visual Basic for Applications macro saves a document in RTF-DCA format on any computer.
NOTE: In the following sample, replace "RFTDCA" with the class name that you want to Save As. For a list of class names, see the "How to Obtain Class Names" section later in this article.
For more information about the SaveFormat property, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type SaveFormat in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
How to Obtain Class NamesThe following list contains converters and class names that are installed by Word and that you can use for saving a document.
To retrieve other class names for an installed converter to Save As, you can loop through the FileConverters collection.
The following sample macro loops through all installed converters that you can use for saving, and then it inserts the converter name and associated class name into a blank document:
For more information about the ClassName property, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type ClassName in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
For additional information about the text converters included with the Microsoft Office 2000 Setup or the Microsoft Office Converter Pack, click the article number below to view the article in the Microsoft Knowledge Base:
235928For additional information about getting help with Visual Basic for Applications, click the article numbers below to view the articles in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/235928/EN-US/ )WD2000: Supported File and Graphics Formats
(https://support.microsoft.com/kb/212623/EN-US/ )WD2000: Macro Programming Resources
(https://support.microsoft.com/kb/226118/EN-US/ )OFF2000: Programming Resources for Visual Basic for Applications