Domino 9 und frühere Versionen > Entwicklung

FileSystemObject

(1/1)

pippo:
Hallo Leute,

FileSystemObject ist eine total geile Sache! 8)

nur bei OpenTextFile gibt es mir immer einen Fehler zurück!? ???

Dim fs, a, retstring
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile("c:\testfile.txt", ForReading, False)

Kann mir da bitte jemand einen Tipp geben?

Grüße, Pippo

Axel:
Hi,

wie lautet denn die Fehlermeldung.


Ich vermute, dass es sich bei dem Parameter ForReading um eine Konstante handelt und das sie nicht vorhanden ist.

Axel

Rob Green:
Sub OpenTextFileTest
   Const ForReading = 1, ForWriting = 2, ForAppending = 8
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
   f.Write "Hello world!"
   f.Close
End Sub

Function ReadTextFileTest
   Const ForReading = 1, ForWriting = 2, ForAppending = 8
   Dim fso, f, Msg
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
   f.Write "Hello world!"
   Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)
   ReadTextFileTest = f.Read(5)
End Function

Wo hast Du ForReading bei Dir definiert?
Laut MS KN Base heißt es:
"iomode
Optional. Can be one of three constants: ForReading, ForWriting, or ForAppending. "

Settings
The iomode argument can have any of the following settings:
Constant Value Description
ForReading 1 Open a file for reading only. You can't write to this file.
ForWriting 2 Open a file for writing.
ForAppending 8 Open a file and write to the end of the file.

pippo:
Hallo,

danke für die schnelle Antwort! 8)

Wünsche Euch noch einen schönen Tag

aus Italien,
Pippo

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln