A few words of thanks would be greatly appreciated.

Excel 2007 - Insert an image with transparency


This demo handles several deficiencies of Excel to insert images and apply transparency.
There exist at least two possibilities to insert an image in an Excel sheet,
1)Insert Image directly
  • Insert> Image
  • You can enter the picture you want but if you enter an image of 1920 x 1088 pixe, Excel will display an image having the following dimension 1920 x 1088 centimeters!.
  • Another solution: Use an image control tools (OCX Controls), spread it on the sheet, right click and select> Developer> Insert> Image and apply it on the sheet.
  • Right click on the image>> select Properties.
  • Set PictureSizeMode = 3
  • In the Properties window, go to Picture and select an image to be included in the control.
  • So farthe picture is inserted into the control while maintaining the width/height ratio. You can adjust the size of the control to coincide with the dimensions of the image.
  • But note that transparency options are not available.

2) Insert image in a form
  • Insert> Form
  • Draw the rectangle
  • Right click> Format Shape. Select Picture or texture fill.
  • Simply use the image of your choice.
  • Using this method you can adjust the transparency of the image, but not its ratio.

This demo aims to:
  • Insert an image while keeping the ratio.
  • Keep the dimensions
  • Keep the ratio of the image.
  • Transparency available.


Using GDI + APIs for the dimensions of the image

You can move the image, rotate it, change the dimensions of the available area.
But it is not advisable to resize the image with the handles (and thus lose the ratio of the image).

For the demo I have determined the surface area available with the top right of the button Changer Image:

But it is easy to directly enter the dimensions in the code
In Module1, look for the RemplaceImage routine.
 'Rectangle disponnible pour l'image, en points
    With Sheets("Image").CommandButton1
        Dispo.W = (.Left + .Width)
        Dispo.H = .Top
    End With

Replace these lines with
'Rectangle disponnible pour l'image, en points
        Dispo.W = La largeur en point
        Dispo.H = La hauteur en point

CAUTION: These dimensions are not those of the image, depending on the ratio of the image file only one of the two will be effective.


Demo with image file 3.2 Mb
Demo without image file 32Kb


A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.


This document, titled "Excel 2007 - Insert an image with transparency," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).