Convert Word RTF to Metafile Picture

L

Lee

We have a application that exports Word RTF files that we must get into a
consolidated master document. The master document has strict margin
limitations so we are not able to take the RTF files and directly paste them
into the consolidted document. Does anyone have any code, or can point me to
something similar, that does the following:

1. Open up the exported RTF file
2. Change the view to outline view.
3. Highlight and select the first page and do a copy.
4. Go back to the master document and do a paste special metafile.
5. Resize the picture to the margins.
6. Redo steps 3-5 until all pages of the RTF file have been pasted in.

If anyone has any better ideas on how this might be done, will appreciate
any help. Many of the exported RTF files are hundreds of pages long, and
pasting one page at a time is very time consuming. This is the only way we
have found that maintains all of the formatting of the original RTF file and
can be fitted into the designated margins. It gets the job done but there
has to be a better way. Thanks,
 
D

Doug Robbins - Word MVP on news.microsoft.com

Try the following:

Dim source As Document, target As Document
Dim trange As Range
Dim i As Long
Set source = Documents.Open("the RTF File")
Set target = Documents.Open("The Master Document")
source.Activate
i = 0
With source
While i < .BuiltInDocumentProperties(wdPropertyPages)
Selection.HomeKey wdStory
.Bookmarks("\Page").Range.Cut
Set trange = target.Range
trange.Collapse wdCollapseEnd
trange.PasteSpecial DataType:=wdPasteMetafilePicture
i = i + 1
Wend
End With

I am not sure that you will need to do anything about resizing the image to
fit the page.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top