|
-
August 8th, 2001, 12:47 PM
#2
Re: How to read MS Word file to RTB and edit it and save it Or how to READ MS Word? The rtb control
'DO not forget to add reference to Word library
Dim WordApp As Word.Application
Dim Document As Object
Private Sub Command1_Click()'write
Set WordApp = CreateObject("Word.Application")
Set Document = Word.Documents.Add
' Place some text in the doc
Document.Range.InsertBefore RichTextBox1.Text & vbCrLf & vbCrLf
Document.SaveAs App.Path & "\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()'read
Set WordApp = CreateObject("Word.Application")
Set Document = Word.Documents.Add
Word.Documents.Open App.Path & "\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
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|