LibreOffice 7.3 Hjälp
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.
Om uttryckslistan utelämnas lägger Write-satsen till en tom rad i filen.
Om du vill lägga till en uttryckslista i en ny eller befintlig fil måste filen öppnas i Output-läge eller Append-läge.
De strängar som du skriver omges av citationstecken och avgränsas med kommatecken. Du behöver inte föra in dessa avgränsare i listan över uttryck.
Alla Write-satser ger en symbol för linjeslut som sista inmatning.
Tal med decimalavgränsare konverteras enligt de lokala inställningarna.
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