File size when inserting pdf via Insert->Object vs. via marco

U

Uwe

Word version: 97-2000

Background: I need to insert 200+ small (~40KB) pdf files into a Word
doc.

Doing it manually works fine via Insert->Object->Adobe Acrobat
Document.

Now I wanted to automate the process and wrote a little VB macro (see
insert example below, the final macro doesn't hard code the file name,
uses a loop and does some other things, but the code below
demonstrates the issue).

Problem: When I save the document where I inserted the file manually
it's ~80KB. However, a document where I inserted the file via the
macro is 1.5MB and it adds 1.5MB for each additional pdf.

I'm new to VB , so what am I missing? What is word adding when using
the macro?
I recorded a macro when inserting by hand it comes up with the same
code as in the macro below.

I tried Word 2007 and the doc does not swell up nearly as much,
however not everyone who needs the doc has 2007. Saving from 2007
to .doc format gives a huge document also.

Thank you


Sub Macro1()

Dim strFileName As String

strFileName = "D:\tmp\test.pdf"

Selection.InlineShapes.AddOLEObject ClassType:="AcroExch.Document.7",
_
FileName:=strFileName _
, LinkToFile:=False, DisplayAsIcon:=False

End Sub
 
G

Graham Mayor

When I insert a PDF manually and save the document as doc, the file size is
exactly the same as when I insert it using a macro similar to your own,
which would be about 1.5mb for each object, attributable to the overhead of
rendering the PDF in the document. Running the vba code does not contribute
to the file size and inserts the object exactly as if you had done so
manually. The reason that the file size is smaller with Word 2007 docx
format is that this is a compressed format ... a zip file.

200 PDF files in a document is asking a lot. I would suggest that you try
combining the files with Acrobat which will produce a smaller file than the
combined size of the original PDFs.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
U

Uwe

Thanks for the info. Looks like PDF will not work for me.

Those PDF's are figures. I'll have to see that I can get them in
another format more suitable for inclusion in a Word doc.
 

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