Hello all.
I'm making some software that uses a base of separate MS-Word documents that have to be collated into one new document. I have found some about the Word Interop, but not what i need.
Here is the code i have. What i need is the part that copies all the text from the Source document and append it to the target document.
CODE
Sub DocCreate()
Dim oWord As Word.Application = Nothing
Dim oSourceWord As Word.Application = Nothing
Dim oDoc As Word.Document = Nothing
Dim oSourceDoc As Word.Document = Nothing
Dim oTable As Word.Table = Nothing
Dim oPara(100) As Word.Paragraph
Dim oRng As Word.Range = Nothing
Dim oShape As Word.InlineShape = Nothing
Dim oChart As Object = Nothing
Dim oBookmark As Word.Bookmark = Nothing
Dim Pos As Double = Nothing
Dim X As Integer = 0, Max As Integer = 0
Dim TMP As String = Nothing
Dim intNumberOfPages As Integer = 0
Dim intNumberOfChars As String = 0
Dim intPage As Integer = 0
oWord = New Word.Application
oSourceWord = New Word.Application
oSourceWord.Visible = False
oWord.Visible = True
oDoc = oWord.Documents.Add
oWord.Caption = OffCaption
Max = SelectedDocs.Items.Count
For X = 0 To Max - 1
TMP = SPath & SelectedDocs.Items.Item(X)
oSourceDoc = oSourceWord.Documents.Open(TMP)
[color=#33CC00] 'oSourceDoc.Select()
'oPara(X) = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
'oPara(X).Range.Text = " "
'oPara(X).Format.SpaceAfter = 6
'oPara(X).Range.InsertParagraphAfter()[/color]
Next
End Sub
A short description of the software and its function.
The software has 2 listboxes. The left one contains the possible Word Documents, the right will contain the by the user selected Word Documents. When done the user clicks on the "Generate Button" and the software creates a new Word Document that contains all the text from the documents in the right listbox, in the order that they show in the right listbox.
As one picture says more than thousend words.....

So i need help with the code to select text from one Word Document and copy i to the end of another Word document.
This post has been edited by ericdevet: 10 Oct, 2008 - 01:29 AM