|
-
Jun 5th, 2000, 09:18 PM
#1
Thread Starter
Junior Member
Hi,
I'm going deeper into the VBA programming, I'm trying to make a program for Word. A part of the code goes like this (thanks to RealisticGraphics):
...
Set NewDoc = Word.Documents.Add
NewDoc.Content = Doc1.Content & Doc2.Content
Set NewDoc = Nothing
...
Everything (almost) works, but my problem is that in the new word document everything has changed from Doc1 and Doc2 (the character font, the titles of parts...). Is there a way to add two (or more) word documents in a new one while keeping the formatting ?
Thanks.
-
Jun 6th, 2000, 05:38 PM
#2
Thread Starter
Junior Member
Forget it, I've done it in a different way.
-
Jun 6th, 2000, 06:28 PM
#3
Lively Member
This code should do it:
Code:
Dim Doc1 As Document
Dim Doc2 As Document
Dim NewDoc As Document
Documents.Open "c:\tmpp\asdasdassa.doc"
Set Doc1 = ActiveDocument
Documents.Open "c:\tmpp\qwerty.doc"
Set Doc2 = ActiveDocument
Set NewDoc = Documents.Add
NewDoc.Range = Doc1.Range & Doc2.Range
Doc1.Close
Doc2.Close
Content is Text-only, while Range is with formatting.
-
Jun 6th, 2000, 07:03 PM
#4
Thread Starter
Junior Member
Thanks again, it's the second time you help me today. Thank u, I really appreciate.
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
|