Discussion Locked

VB 6.0 as front end.

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

If I have more than 2 MS-Word files containing the text and diagrams or any other data. How can I club those data and put them in a single MS-Word file. Please help me in this concept and mail me the solution for this with a sample example.

Waiting for ur reply...
Thanking you,

3 replies

by tjc

Are you talking about writting a VB program to do this automatically for you?

Else it may just be easire to just load up each file and then do a copy & paste from each document.

by lexingtonit

create one form with two textboxes and one command button. paste the following codes.
Select the MS word object references for the project.

in text1 enter the directories that contains all the word documents.
in text2 enter the name of the final single file you want to save.

then click on command1. It should work.

HTH

Willie

Private Sub Command1_Click()

Dim fso
Dim f
Dim file

Dim x As New Word.Document

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.Getfolder(Text1.Text & "\")

For Each file In f.Files
If Right(file.Name, 3) = "doc" Then
x.Range(0, 1).InsertFile Text1.Text & "\" & file.Name, , False
End If
Next

x.SaveAs Text2.Text

MsgBox "Done and saved as " & Text2.Text

End Sub

This discussion is closed to new replies.