MrExcel Publishing
Your One Stop for Excel Tips & Solutions

What do these controls do(can someone tell me)

Posted by steve on April 13, 2001 9:41 AM

Can someone tell me what these controls are used for and how to use them. (They are all found in the control toolbox in the more controls)

Image combobox control
Image list control
listview control

also do you think these controls are what I need to do the following.
Thanks for any help steve

This was my previous post

How can I make a picture appear by simply clicking on a cell. Lets say picture 1 appear when cell a1 was selected, 2 when B1, 3 when c1 and so on. I also need a way to close and enlarge it(maybe with a userform?).

Posted by Dax on April 14, 2001 7:45 AM

There are a few ways you could do this. One would be to add an image control to your worksheet and then right click the sheet tab and select View Code. Then enter this:-

Private Sub Image1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Image1.Visible = False
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Columns.Count > 1 Or Target.Rows.Count > 1 Then Exit Sub

If Sheets("Images").Cells(Target.Row, Target.Column) <> "" Then
Image1.Picture = LoadPicture(Sheets("Images").Cells(Target.Row, Target.Column))
End If
Image1.Visible = True

End Sub

You'll need to have a sheet which lists the full path of each image, e.g. if the sheet Images contains the string C:\windows\picture.bmp in cell A1 then this would be the picture loaded into the image control when cell A1 is selected on your sheet. The image will disappear when double clicked. As for being able to resize, the image control supplied with VBA doesn't have a Stretch property so can't be resized. If you have Visual Basic installed on your machine you could use the slightly more sophisticated Image control supplied with that.

Hope this helps,