文件模式损坏(错误 54)

操作文件内容中使用的语句必须适合打开文件的模式。 此错误具有以下原因和解决方案:

  • A Put or Get statement is specifying a sequential file. Put and Get can only refer to files opened for Random or Binary access.

  • A Print # statement specifies a file opened for an access mode other than Output or Append. Use a different statement to place data in the file or reopen the file in an appropriate mode.

  • An Input # statement specifies a file opened for an access mode other than Input. Use a different statement to place data in the file or reopen the file in Input mode.

  • 您尝试对只读文件进行写入。 更改文件的读/写状态或不尝试对其进行写入。

有关其他信息,选择有问题的项并按 F1(在 Windows 中)或 HELP(在 Macintosh 上)。

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。