G
gvanaco
Hi,
I have searched a few day's for the next problem.
I have several document in a directory.
With a simple form I would make one big document.
The form part is working, but I can't merge the documents together.
With the code below, I get only the result of the last document.
Public Sub copy_selection_from_file_2()
Dim docBron As Word.Document
Dim docOut As Word.Document
Dim rngIn As Word.Range
Dim rngOut As Word.Range
'
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron_1")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron_2")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
End Sub
somebody a hint how it could work??
I have searched a few day's for the next problem.
I have several document in a directory.
With a simple form I would make one big document.
The form part is working, but I can't merge the documents together.
With the code below, I get only the result of the last document.
Public Sub copy_selection_from_file_2()
Dim docBron As Word.Document
Dim docOut As Word.Document
Dim rngIn As Word.Range
Dim rngOut As Word.Range
'
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron_1")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron_2")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
End Sub
somebody a hint how it could work??