Import or merge DWG / Picture files into a document

R

Rookie_User

I have a folder full of dwg files (AutoCAD files). You can insert the file
manually so I know it accepts the format. However, my goal is to create a
page with six squares (a table 2x3) and insert a picture in each square and
then it will repeat as it processes through all the files in the designated
folder. If possible it would be nice that the filename gets posted somewhere
for identification purposes. Does this make sense, can anyone help?

I have started to research on the board how to do this but haven't found a
solution to get me there yet.
 
P

Peter Jamieson

Insert the file manually but select the "Insert and Link" option on the
drop-down at the right hand side of the Insert button. Then use Alt-F9 to
look at the INCLUDEPICTURE field that Word inserted. There will probably be
a "\c switch" near the end that specifies the converter name for dwg files.
Let's assume it says "\c dwg" for example.

One way to merge the files is to create a data source (for example a table
in another Word document) where one of the columns contains the file name of
the image file. Each row should list one of the files. Generally speaking
it's a good idea to have more than one column in a data source as Word can
sometimes get stuff wrong if you don't.

So suppose you have a column x that just contains something to keep Word
happy, and a column picfile that contains the name of your file. e.g.

x,picfile
1,mypic1.dwg
1,mypic2.dwg
1,mypic3.dwg


OK, so this isn't automatically picking the file names from your directory,
but maybe you can do that step later if you really need it.

Then use either the mail merge wizard or the mail merge toolbar (Word
Tools|Customize) to create a new mail merge main document and attach the
data source you just created.

As far as the layout is concerned,
a. Table|Insert table, select 2x3, select Fixed column width and specify
the column width.
b. Select the table. In Table|Table|Properties...|Row| specify the row
height you want and select the "Exactly" setting.

You should then have a layout that pictures will fit into, with any
necessary scaling. If I'm wrong about that you won't get much further with
that bunch of settings...

Then in cell one of your table, insert the following nested field using the
converter name you noted above. Use ctrl-F9 to insert each pair of {} and
type everything else. Let's suppose your pictures are in c:\mypictures.

{ INCLUDEPICTURE "c:\\mypictures\\{ MERGEFIELD picfile }" \c dwg }

Make sure there are no spaces in the file name that should not be there.
Then select the fields, edit|copy to cell 2. In cell 2, insert another
field, { NEXT } before the { INCLUDEPICTURE } field. Then select the two
fields, edit|copy and paste to all the other cells.

(you may well be able to do all the above by setting up a "label merge",
defining a custom layout, inserting the content of cell 1 as suggested, then
"propagating the fields" to the other cells).

Then merge to a new document. You will probably see a document where all the
pictures look the same. Select the new document (e.g. using ctrl-A) and
press F9 to re-execute all the fields. With any luck you should see a
different picture in each table cell.

Try that for starters and see how far you get.

Peter Jamieson
 
D

Doug Robbins - Word MVP

See the "Graphics from data base" item under the "Special merges" section of
fellow MVP Cindy Meister's website at

http://homepage.swissonline.ch/cindymeister/MergFram.htm

You are probably not going to be able to do this with mailmerge. It would
however, using vba, be possible to "roll-your-own" application to do it.


--
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
 
R

Rookie_User

Peter, Thank you for your help and I think I am following it correctly. I
messed it up last night and will try again today to see if I interpret your
excellent documentation. Thanks again.

Doug: I appreciate your help as well, sometimes the answer is perfect, and
other times you all just point out different and more efficient methods, I
appreciate all your help.
 
R

Rookie_User

Could you expand on your suggestion of roll your own program. I know very
basic VBA and generally come here and other sites to get me started. It
appears to be more difficult mechanically than mentally - it seems easy in my
head - smile. Would it make a difference if I converted them to JPG's?
 
D

Doug Robbins - Word MVP

Part of the exercise would involve using the information in the article
"Insert into a document the names of all files in a selected folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/InsertFileNames.htm

Then, if you record the action of inserting a picture into a document, you
will get some code that you can use to do that part of it.

Then you will need to create a document with a one row, two column table
with the required cell dimensions, the iterate through the list of files
created following the first link, inserting each one in turn, into a cell in
the table, adding a new row the the table after every second one.

See how you get on with another shot at Peter's suggestion first as there is
no point in re-inventing the wheel if it works OK.


--
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
 
R

Rookie_User

OK, there is a lot going on in that response so I will disect it and see what
I come up with. However, once again, thank you for such a detailed
explanation.

*One of these days I find out what MVP is and if your employed by Microsoft?
If so, who do we tell that this is an invaluable service.
 
D

Doug Robbins - Word MVP

No, we are not employed by Microsoft.

See

--
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
 

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