Method: CreateTextFile for Folder
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Methods > Method: CreateTextFile for Folder
Method: CreateTextFile for Folder
Creates a file in a folder and returns the associated TextStream object.
Set oTextStream = Object.CreateTextFile(FileName, [Overwrite], [Unicode])
Object | Folder Object with this method |
FileName | String Specifies the filename. |
[Overwrite] | Boolean Specifies whether DIAdem overwrites an existing file. If the value is True, DIAdem overwrites an existing file. If the value is False, DIAdem does not overwrite an existing file. The default value is False. |
[Unicode] | Boolean Specifies whether DIAdem creates a Unicode or an ASCII file. If the value is True, DIAdem creates a Unicode file. If the value is False, DIAdem creates an ASCII file. The default value is False. |
oTextStream | TextStream Returned object |
The following example creates a text file, writes a text into this file, and then closes the file:
Sub CreateMyTxtFile(sFolder,sFile,sText) Dim fso, oMyFolder, oMyFile Set fso = CreateObject("Scripting.FileSystemObject") Set oMyFolder = fso.GetFolder(sFolder) Set oMyFile = oMyFolder.CreateTextFile(sFile, True) Call oMyFile.WriteLine(sText) Call oMyFile.Close End Sub