| This code open word In the background, create a new document and write the text from the RTF Box In the test.doc file. It also Do the same thing the other way around.(Basically, but it dont see the return key) This works For txt only! Dim WordApp As Word.Application Dim Documents As Object Private Sub Command1_Click() Set WordApp = CreateObject("Word.Application") Set Document = Word.Documents.Add ' Place some text in the doc Document.Range.InsertBefore RichTextBox1.Text & vbCrLf & vbCrLf ' Save the sheet to C:\test.doc directory Document.SaveAs "C:\ TEST.DOC" ' Close Word with the Quit method on the Application object Word.Application.Quit ' Release the object variable Set WordApp = Nothing End Sub Private Sub Command2_Click() Set WordApp = CreateObject("Word.Application") Set Document = Word.Documents.Add Word.Documents.Open "C:\ TEST.DOC" RichTextBox1.Text = Word.ActiveDocument.Range 'Word.Documents.Open Word.Application.Quit ' Release the object variable Set WordApp = Nothing End Sub Private Sub Command3_Click() Unload Me End Sub |
Write txt to doc file. |
Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design