全部显示

SaveFormat 属性

       

返回指定文档或文件转换器的文件格式。该值将是指定一个外部文件转换器或一个 WdSaveFormat 常量的唯一数字。Long 类型,只读。

expression.SaveFormat

expression   必需。该表达式返回“应用于”列表中的一个对象。

说明

使用 SaveAs 方法的 FileFormat 参数的 SaveFormat 属性值可用没有对应的 WdSaveFormat 常量的文件格式保存文档。

示例

如果活动文档为 RTF 格式的文档,本示例将其另存为 Microsoft Word 文档。

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

本示例新建一篇文档并在表格中列出可用于保存文档的转换器及其相应的 SaveFormat 值。

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

本示例以 WordPerfect 5.1 或 5.2 第二种文件格式保存活动文档。

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