LibreOffice 7.2:n ohje
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.
Jos lausekeluettelo on jätetty pois Write-lause lisää vain tyhjän rivin tiedoston loppuun.
Jotta lausekeluettelosta voitaisiin lisätä tiedot uuteen tai jo käytettyyn tiedostoon, tiedosto pitää olla avattu Output- tai Append-tavalla.
Kirjoitettavat merkkijonot suljetaan lainausmerkkeihin ja erotellaan pilkuilla. Näitä erotinmerkkejä ei tarvitse käyttää lausekeluettelossa.
Jokaisen Write-lauseen viimeisenä merkkinä tulostuu rivinloppumerkki.
Luvut, joissa on desimaalierottimia, muunnetaan maa-asetusten mukaisesti.
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