Bad file mode

Statements used in manipulating file contents must be appropriate to the mode in which the file was opened. Possible causes include:

  • A FilePutObject or FileGetObject statement specifies a sequential file.
  • A Print statement specifies a file opened for an access mode other than Output or Append.
  • An Input statement specifies a file opened for an access mode other than Input
  • An attempt to write to a read-only file.

To correct this error

  • Make sure FilePutObject and FileGetObject are only referring to files open for Random or Binary access.
  • Make sure Print is specifying a file opened for either Output or Append access mode. If not, use a different statement to place data in the file, or reopen the file in an appropriate mode.
  • Make sure Input is specifying a file opened for Input. If not, use a different statement to place data in the file or reopen the file in an appropriate mode.
  • Make sure you are not attempting to write to a read-only file. If so, change the read/write status of the file, or don't try to write to it.

See Also

Accessing Files with FileSystemObject

Show: