[Solved] Read plain text file
Posted: Thu Aug 05, 2010 12:25 pm
Hello,
I muddled through creating a simple macro that reads the contents of a plain text file and inserts it in the current Writer document:
The problem is that the macro considers paragraph breaks in the text file as end of file, so it only reads the first paragraph of the file. How do I make it read the entire file? Thanks!
I muddled through creating a simple macro that reads the contents of a plain text file and inserts it in the current Writer document:
Code: Select all
Sub Dummy()
ThisDoc=ThisComponent
ThisText=ThisDoc.Text
TheCursor=ThisText.createTextCursor
DummyTxt="dummy.txt"
f1 = FreeFile()
Open DummyTxt for Input as #f1
Do while NOT EOF(f1)
Line Input #f1, s
TheCursor.String=s
Loop
Close #f1
End Sub