![]() |
#1
|
|||
|
|||
![]() I'm working with Word 2010 to put together some nametags. Each set of nametags contains anywhere from 300 - 600 names. I take the images out of an image in paint and put them into Word onto the nametags. Everything was working fine until lately, where this strange issue started showing up: In a large majority of my files, the first 1 - 15 images would actually be other random images from the document. To clarify, the first few show the images they're supposed to be, yet when I print them they display a different image. Also, if I double click the image to open in paint, it shows the wrong image as well. Here's a screenshot of what's happening: ![]() I think I've narrowed this down to one of three things.
Here's the macro I've been using: Code:
Sub FormatPicture() Selection.PasteSpecial Link:=False, Placement:=wdWrapTight, _ DisplayAsIcon:=False With Selection.ShapeRange .LockAspectRatio = msoTrue .Height = InchesToPoints(1.4) .WrapFormat.Type = wdWrapTight .IncrementLeft 50 .IncrementTop -5 End With End Sub |
#2
|
||||
|
||||
![]()
If your image & name data are held in, say, a database, Excel workbook or a Word table, you could probably achieve the desired outcome with no vba at all, using Word's mailmerge tools.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
The name data is pulled through a mailmerge, but the images come straight from a scanned yearbook page. It would be a lot of extra work to cut each one out and save it and then link it in the database.
|
#4
|
||||
|
||||
![]()
Actually, if the image names are the same as the names in the database, you don't need both to be in the database; the mailmerge can use the name field for referfencing the images.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
This would still require the cropping and saving of each image, instead of selecting and copying them. This is something I'd like to avoid.
|
#6
|
||||
|
||||
![]()
So you're doing this manually for 300 - 600 images per file? For safety, you really should be saving these to disk, cropped so that each image represents one student, before adding them to Word. If you don't, you risk losing the lot if the document becomes corrupted - which it's already showing signs of.
FWIW, if you're using the docx format your existing images can easily be extracted by changing the file's extension to .zip, then opening the file as a zip archive from where you can readily copy the images to a folder. As for the cropping concerns, perhaps you could explain the current process? In any half-decent graphics program (even Windows Paint) you should be able to select an area then save the selection as a new file (copying to a new file might be required first).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
![]()
I'm not doing it entirely manually. I use programmable keys on my keyboard. One to select and copy the picture (using a mousekeys macro) and another to trigger the macro in Word. It takes me about 45 minutes to an hour to do 400 nametags depending on my concentration.
The macro first exectutes a paste special -> As image to get the image on the nametag correctly. It then sets the word wrapping, size, and position. I see what you mean by saving them for safety though. I hadn't thought about it that way. Would it cause issues to link to non-existant files (name + .png) in the merge? That would mean I would just have to cut the pictures out and save them into the directory it's pointing too. |
#8
|
||||
|
||||
![]()
The only negative issue I'm aware of with mailmerges is that, if there is no image file for a particular record, some Word versions repeat the image from the previous record - other versions output either a blank rectangle or an error message. The simple solution is to ensure there is an image file for every record. Where you don't have a picture, substitute a generic image file (perhaps with the words 'no picture available' on it).
If you do decide to go down the mailmerge route, let me know as there are some setup issues you might need help with.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
Unfortunately I'm finished with the nametags for now (there were 15 sets), and won't have a new set to work with for quite a while. I have another set re-exported for testing purposes (I'm not in charge of the merge though). I'll let you know if something comes up.
|
![]() |
Tags |
images, macro, word 2010 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can't paste images into Word! | Jemko | Word | 1 | 02-18-2012 09:53 AM |
![]() |
Sonia Sosa | Mail Merge | 8 | 04-22-2011 03:05 PM |
![]() |
sulasno | Drawing and Graphics | 4 | 04-09-2011 07:28 AM |
![]() |
WaltR | Word | 2 | 02-13-2011 10:43 PM |
![]() |
questiona | Drawing and Graphics | 2 | 01-03-2011 03:07 PM |