+ Reply to Thread
Results 1 to 2 of 2

Word Macro for inserting Multiple Pictures

  1. #1
    Registered User
    Join Date
    10-01-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Word Macro for inserting Multiple Pictures

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

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Word Macro for inserting Multiple Pictures

    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
    [Fmr MS MVP - Word]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1