SaveFormat Property

Microsoft Word Visual Basic

constant. Read-only Long.

WdSaveFormat can be one of the following WdSaveFormat constants.
wdFormatDocument
wdFormatDOSText
wdFormatDOSTextLineBreaks
wdFormatEncodedText
wdFormatHTML    
wdFormatRTF
wdFormatTemplate
wdFormatText
wdFormatTextLineBreaks
wdFormatUnicodeText

expression.SaveFormat

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

Use the value of the SaveFormat property for the FileFormat argument of the SaveAs method to save a document in a file format for which there isn't a corresponding WdSaveFormat constant.

Example

If the active document is a Rich Text Format (RTF) document, this example saves it as a Microsoft Word document.

If ActiveDocument.SaveFormat = wdFormatRTF Then
    ActiveDocument.SaveAs FileFormat:=wdFormatDocument
End If
		

This example creates a new document and lists in a table the converters that can be used to save documents and their corresponding SaveFormat values.

Sub FileConverterList()
    Dim cnvFile As FileConverter
    Dim docNew As Document

    'Create a new document and set a tab stop
    Set docNew = Documents.Add
    docNew.Paragraphs.Format.TabStops.Add _
        Position:=InchesToPoints(3)

    'List all the converters in the FileConverters collection
    With docNew.Content
        .InsertAfter "Name" & vbTab & "Number"
        .InsertParagraphAfter
        For Each cnvFile In FileConverters
            If cnvFile.CanSave = True Then
                .InsertAfter cnvFile.FormatName & vbTab & _
                    cnvFile.SaveFormat
                .InsertParagraphAfter
            End If
        Next
        .ConvertToTable
    End With

End Sub
		

This example saves the active document in the WordPerfect 5.1 or 5.2 secondary file format.

ActiveDocument.SaveAs _
    FileFormat:=FileConverters("WrdPrfctDat").SaveFormat