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:
  • Microsoft Word 2000


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

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


  • WdFormatDOSText


  • WdFormatDOSTextLineBreaks


  • WdFormatEncodedText


  • WdFormatHTML


  • WdFormatRTF


  • WdFormatTemplate


  • WdFormatText


  • WdFormatTextLineBreaks


  • wdFormatUnicodeText


For example, to use a constant for the HTML save example above, use:

ActiveDocument.SaveAs FileName:= "myHTMLdoc", FileFormat:= WdFormatHTML 

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/overview/overview.asp
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: September 30, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.