Довідка LibreOffice 7.3
Writes data to a sequential text file with delimiting characters.
Write [#fileNum] {,|;} expression [, …]
fileNum: Any numeric expression that contains the file number that was set by the Open statement for the respective file.
expression list: Variables or expressions that you want to enter in a file, separated by commas.
Якщо список виразів пропущено, то оператор Write додає до файлу порожній рядок.
Щоб додати список виразів до нового або існуючого файлу, цей файл повинен бути відкритий в режимі Output або Append.
Введені рядки беруться у лапки і розділяються комами. У списку виразів необхідність у використанні роздільників відсутня.
Кожен вираз Write виводить символ кінця рядка у вигляді останнього запису.
Числа з десятковими значеннями перетворюються відповідно до локальних параметрів.
Sub ExampleWrite
Dim iCount As Integer
Dim sValue As String
iCount = Freefile
Open "C:\Users\ThisUser\data.txt" For Output As iCount
sValue = "Hamburg"
Write #iCount,sValue,200
sValue = "New York"
Write #iCount,sValue,300
sValue = "Miami"
Write #iCount,sValue,450
Close #iCount
End Sub
Sub ExampleWrite
Dim iCount As Integer
Dim sValue As String
iCount = Freefile
Open "~/data.txt" For Output As iCount
sValue = "Hamburg"
Write #iCount,sValue,200
sValue = "New York"
Write #iCount,sValue,300
sValue = "Miami"
Write #iCount,sValue,450
Close #iCount
End Sub