WD2000: Err Msg: "Word cannot save files. The converter for this format can only open files."

ID: Q224066


The information in this article applies to:


ERROR MESSAGE

When you try to save a document in a different file format using a recorded Visual Basic for Applications (VBA) macro, the following error message may appear:

Word cannot save <\016\000> files. The converter for this format can only open files.

Where <\016\000> is the value that corresponds to the file format value assigned to the converter on the computer where the macro was recorded.

NOTE: Microsoft Office 2000 has built-in functionality that allows you to get more information about difficult-to-troubleshoot alerts or error messages. If you want to enable this functionality for this and other error messages in Microsoft Office 2000, please download the Microsoft Office 2000 Customizable Alerts file from the Microsoft Office Update Web site at the following address:
http://officeupdate.microsoft.com/2000/downloadDetails/alerts.htm
NOTE: If you reached this article by clicking the Web Info button in an error message, you already have Customizable Alerts enabled.


CAUSE

The value assigned as the export converter in the macro is assigned to an import-only converter on the computer on which the macro is being run.


WHAT TO TRY

The file format value assigned as the export converter in the macro is assigned to an import-only converter on the computer on which the macro is being run.

If you record a macro that changes the file type, the FileFormat property will contain a number. The following sample macro was recorded using HTML as the Save as type:


Sub Macro1()
   ActiveDocument.SaveAs FileName:="myHTMLdoc", FileFormat:=103
End Sub 
Note the number 103 that was recorded for the HTML FileFormat argument. This number may not be the same on another computer.

Use any of the following methods to resolve this problem:

Method 1: Use the FileFormat built-in conversion constant.

FileFormat accepts the following built-in conversion constants:

wdFormatDocument
----------------

Saves as a Word document.

wdFormatText
------------

Text only: Saves text without its formatting. Converts all section breaks, page breaks, and newline characters to paragraph marks. Uses the ANSI character set. Select this format only if the destination program cannot read any of the other available file formats.

wdFormatDOSText
---------------

MS-DOS text: Converts files the same way as Text only format (wdFormatText). Uses the extended ASCII character set, which is the standard for MS-DOS-based programs. Use this format to share documents between Word and non-Windows-based programs.

wdFormatTextLineBreaks
----------------------

Text only with line breaks: Saves text without formatting. Converts all line breaks, section breaks, and page breaks to paragraph marks. Use this format when you want to maintain line breaks. For example, when transferring documents to an electronic mail system.

wdFormatDOSTextLineBreaks
-------------------------

MS-DOS text only with line breaks: Saves text without formatting. Converts all line breaks, section breaks, and page breaks to paragraph marks. Use this format when you want to maintain line breaks, for example, when transferring documents to an electronic mail system.

wdFormatRTF
-----------

Rich Text Format (RTF): Saves all formatting. Converts formatting to instructions that other programs, including compatible Microsoft programs, can read and interpret.

wdFormatTemplate
----------------
Saves as a Word template.

wdFormatUnicodeText
-------------------

Saves as a Unicode text file. Converts text between common character encoding standards, inclucing Unicode 2.0, Mac OS, Windows, EUC, and ISO-8859 series.

Method 2: Use the FileConverters collection to retrieve the correct FileFormat number for a conversion type for any computer.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/refguide/
The following sample Visual Basic for Applications macro saves a document in HTML format on any computer:

NOTE: In the following example, replace "HTML" with the class name you want to use for Save As. For a list of class names, see the "Use the class name of the converter" section later in this article.

Sub SaveAsHTML()
      Dim fcCnv As FileConverter
      Dim strClass As String
      Dim strFileName As String

      ' If there are no documents open to
      ' save, exit this routine.
      If Documents.Count = 0 Then Exit Sub

      ' Set the ClassName to use for saving.
      strClass = "HTML"

      ' Set the FileName to use for saving.
      strFileName = "MyHTMLdoc"

      ' Loop through all installed converters.
      For Each fcCnv In FileConverters
         With fcCnv
            ' Test for conversion ClassName.
            If .ClassName = strClass Then
               ' Save using the FileConverters.ClassName.
               ActiveDocument.SaveAs FileName:=strFileName, _
                  FileFormat:=.SaveFormat
            End If
         End With
      Next fcCnv
   End Sub 


Method 3: Use the class name of the converter.

The following list contains converters and class names installed by Word that you can use for saving a document:

   Converter                                  ClassName
   ----------------------------------------------------

   HTML Document                              HTML
   MS-DOS Text with Layout                    MS-DOS Text with Layout
   Text with Layout                           Text with Layout
   Word 2.x for Windows                       MSWordWin2
   Converter: Word 4.0 for Macintosh          MSWordMac4
   Word 5.0 for Macintosh                     MSWordMac5
   Word 5.1 for Macintosh                     MSWordMac51
   WordPerfect 5.0                            WrdPrfctDOS50
   WordPerfect 5.1 for DOS                    WrdPrfctDOS51
   WordPerfect 5.x for Windows                WrdPrfctWin
   WordPerfect 5.1 or 5.2 Secondary File      WrdPrfctDat
   WordPerfect 5.0 Secondary File             WrdPrfctDat50
   Works 3.0 for Windows                      MSWorksWin3
   Works 4.0 for Windows                      MSWorksWin4
   Word 6.0/95                                MSWord6Exp
   Word 97 & 6.0/95 - RTF                     MSWord6RTFExp 
To retrieve other class names for an installed converter to use for a Save As operation, you can loop through the FileConverters collection. The following sample macro loops through all installed converters that you can use for saving and then inserts the converter name and associated class name into a blank document:

Sub GetConvClassName()
     Dim fcCnv As FileConverter

     ' Create blank document.
     Documents.Add

     ' Loop through all installed converters.
      For Each fcCnv In FileConverters
         With fcCnv
            ' If the converter can be used to save...
            If .CanSave = True Then
               ' Insert the converter name and class name in the document.
               Selection.TypeText "Converter: " & .FormatName & vbTab _
                  & "ClassName: " & .ClassName & vbCr
            End If
         End With
      Next fcCnv
   End Sub 


Back to Top

Additional query words: OFF2000


Keywords          : kbdta 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbprb 


Last Reviewed: June 22, 1999
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.