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
orFileGetObject
statement specifies a sequential file.A
Print
statement specifies a file opened for an access mode other thanOutput
orAppend
.An
Input
statement specifies a file opened for an access mode other thanInput
An attempt to write to a read-only file.
To correct this error
Make sure
FilePutObject
andFileGetObject
are only referring to files open forRandom
orBinary
access.Make sure
Print
specifies a file opened for eitherOutput
orAppend
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
specifies a file opened forInput
. If not, use a different statement to place data in the file or reopen the file in an appropriate mode.If you are writing to a read-only file, change the read/write status of the file or do not try to write to it.
Use the functionality available in the
My.Computer.FileSystem
object.
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for