How to create an image catalog using ActiveX Image Control in Excel

Who I am
Marie-Ange Demory

Author and references

The quality of programs like Microsoft Excel and Word is indisputable. These programs were the most used in computers around the world for many years and the first to be installed independently of operating systems.

The versatility they have when it comes to shaping a job, a report, accounting statistics, inserting charts, tables, lists, spreadsheets, among many other things. Be what it makes the difference from any other program that pretends to be a competition for them.

Even beyond what was thought

Microsoft Excel was not limited to create tables , write numbers and discover new formulas. Any new idea that the group of developers behind this program implements usually makes a big impact, including yours.

In this way, the images became part of Microsoft Excel for give your files a different and dynamic touch , creating impressive creations such as order forms and catalogs.

Image catalog

Surely you thought that for this kind of thing you would need other programs. But the amazing thing about Microsoft Excel is that it allows you to create a catalog of images using the ActiveX Picture Control.

What is it about

The goal of this is that, by selecting a particular cell, it comes the image inserted in that cell it should represent is displayed . That is, taking into account the existence of a database, a cell will represent a code or a product.

When the cell is selected, it will represent that code within the image catalog. If you need some tips on building your database, you just need to be clear about it criteria for him:

  • Codes.
  • Name of the products and their existence in the stock.
  • The images you will use in the catalog.
Read Where are WhatsApp photos, files and videos saved on my Android phone?

It is recommended that all images have the same format and that they are identified with the name of the codes that will be assigned in the Excel workbook.

Creating the image control

In order to draw the picture control inside your Excel file, you need to go to the tab Developer , where you will find different sections, within which you will access:

  1. The option for to insert , clicking.
  • The menu is divided between form controls and ActiveX controls.
  • In the second part of the menu you will find the option to insert image control.
  • After drawing it, click Property .
  • Verify that the section AutoSize remain False .
  • In the PictureAlignment you can select the way you want the image to appear: centered, left or right.
  • Creating events

    So you have to go to the option See code , this is right next to the section Designer mode , and will be used to access the VBA and establish the relevant codes to finish configuring this control.

    • Click on the bar General and you will change it in option Worksheet .
  • The first part of creating the event should look like this:
  • Private Subsheet_SelectionChange (ByVal Target As Range)

    • Immediately after this event, you will write the following:

    If you make a mistake, resume later

    • The above statement will make sure that, in case the process may have an error during the presentation of an image , it will not stop and cause VBA to debug. Rather, skip the error line and move on to the next one.
    • Proceed to write the path as follows:

    Image1.picture = loadPicture (

    • Once the bracket is open, you will need to copy the path to the image. Click on address bar of the file browser, copy and paste it into the box in quotes, then it should look like this:
    Read What are the advantages, advantages and disadvantages of inventory control? (Example)

    Image1.picture = loadPicture ("C: Users usuario usuario Imagenes BBDD " & Target & ". Jpg")

    • The instruction you are establishing with this code is that the image is displayed depending on what you have in the cell.

    Minimize the VBA box, disable the designer mode and click on the codes you have established in your database. In this way, clicking on each cell with the codes, it will show you the corresponding image.

    add a comment of How to create an image catalog using ActiveX Image Control in Excel
    Comment sent successfully! We will review it in the next few hours.