I have been given a task to come up with a Macro that can insert multiple pictures in one MS Word worksheet.So, basically what the intent here is that, we are in the process of issuing ID cards to all the employees at my company, we have a folder where all the employees pictures are stored, every picture is named after the Employee code of each employee.I am looking for a Macro that can pull the picture to each slot (where bold T is written in the attachment) as soon as the Employee code is entered on the MS word sheet.Also, if there is a possibility to also autopopulate the names, i have an excel sheet where all the names are written against each employee codes.Please help me, i'd be highly greatful.
Thanks
Hi Ajay,
If you configure the Excel file correcly, you can do the lot via Word's mailmerge tool, without the need for code. In the Excel file, you'd need every employee's:
• ID
• Details (can be multiple columns)
• Picture name (eg Fred.jpg)
You'd the use a label merge in Word. The only tricky field to produce is for the pictures. For that you'd need a field coded like:
{IF {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\«Image»"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\«Image»"} \d}}
where 'Image' represents the picture column's name in the Excel worksheet and, instead of 'C:\Users\My Document Path\Pictures\' you'd use the actual filepath for the pictures.
Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message. Likewise, you can't type or copy & paste the chevrons (ie '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar.
Once you've laid out the first label correctly, simply click the 'update labels' button to replicate the layout to all labels on the page. The mailmerge will then be ready to run.
Cheers,
Paul Edstein
[MS MVP - Word]
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks