Dim saveFilePath As String saveFilePath = "/tmp/test.txt" Dim lines as Object lines = New Collection lines.Add("test1") lines.Add("test2") Dim simpleFileAccess As Object simpleFileAccess = CreateUnoService("com.sun.star.ucb.SimpleFileAccess") If simpleFileAccess.exists(saveFilePath) Then simpleFileAccess.kill(saveFilePath) End If Dim textOutputStream As Object textOutputStream = CreateUnoService("com.sun.star.io.TextOutputStream") Dim outputStream As Object outputStream = simpleFileAccess.openFileWrite(saveFilePath) textOutputStream.setOutputStream(outputStream) textOutputStream.setEncoding("UTF-8") For Each line In lines textOutputStream.writeString(line) textOutputStream.writeString(Chr(10)) Next line textOutputStream.closeOutput()