Lightboxing Images in Excel

I received an email out of the blue yesterday asking if its possible to put pictures in Excel comments:

I am working on a media report based on creative templates and wanted to give the end user easy access to a view of the creative and my thought was it would be neat to have the ability to build in a comment like function but with graphics.

As far as I know you can't put images in comments, but maybe we can do better. Web developers have developed a technique called Lightbox that was pioneered by Loresh Dhakar. When you click on a thumbnail the image opens full size in the center of your browser screen and the background is grayed out. Check out an example here.

Can we do the same in Excel? Absolutely. Download these two files to see how.

Excel Lightbox.xls

media.jpg (save to the root of your C:\ drive)

Here's a simple report in Excel Lightbox.Excel Lightbox before showing the image

Clicking the Show button brings up the lightbox view. The image is dismissed by clicking on it.

Excel Lightbox before showing the image

This could be improved and extended in lots of ways. The image could be fetched from a URL. Thumbnails could be automatically generated. I'd love to see your ideas on how to extend this.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. All source code is released under a BSD License unless otherwise specified.

17 comments | Show all comments only the last 5 are shown


April 9, 2009
Jim said:

Chris, I am enjoying playing with the lightbox code and am extending it to pick different pictures depending on the active cell selected. I have 125 jpeg files of marine invertebrates I want to pop up in a spreadsheet, each selected by the user by positioning to an active cell containing the name of the invertbrate. I can get the program to pick filenames from different locations to insert, but I cannot seem to move the location of the picture from row 3 column 2, even when I unlock everything and force new row and column positions for the insert. Any ideas? Thanks!


April 11, 2009
Joaquin said:

I have a similar idea to Jim. Can you show your code here Jim?


October 12, 2009
Ruoall Chapman said:

Hi,

Please help.

The sample files work perfectly, but as soon as I try to replicate it in Excel 2007 it doesnt work all that well.

The background shading does not appear and the buttons do not hide themselves when displaying the lightbox images.

Your comments or suggestions would be higly appreciated.

Thank you,

Ruoall Chapman


November 24, 2009
Frank said:

Hi,

I like your code, but how can I show an animated GIF image?

Thanks
Frank


July 23, 2010
Alex Wuethrich said:

Hi, the sample will work. but, if I have pics in the sheet, all pics will delete. Have you any ideas? Thx Alex

Your name

Email (optional, will not be shared)

Type the word "juice" (required to confuse the spammers)

Your comment


Add a comment