Filehandling error

H

Hans

Hello,

'---
Open "c:\test.txt" For Output As #1 ' Open file for output.
Write #1, "blabla"
Close #1
'---

Why doesn't this work, it worked before?

Error message: (in Dutch)
Fout 54 tijdens uitvoering:
Ongeldige bestandsmodus

Please help.
Thanks,
Hans
 
D

Douglas J. Steele

You should never hard-code the file number alias.

Dim intFile As Integer

intFile = FreeFile()
Open "c:\test.txt" For Output As #intFile ' Open file for output.
Write #intFile, "blabla"
Close #intFile

As Allen pointed out, though, you might also want to use Print #intFile
instead.
 
H

Hans

Thanks Allen and Douglas for your responses but it also doesn't work.
It gives the same errortext in Dutch: "Ongeldige bestandmodus" something
like "not valid file mode"

Hans
 
H

Hans

I have permission to write that's not the problem, I think I miss a
addon-file or something to access this type of commands.
Thanks anyway!

Hans
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top