Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CREATING IMAGE POPUP FOR EXCEL 1

Status
Not open for further replies.

QUILO

Technical User
Sep 27, 2002
18
MX
I have created on excel a list of products with item number, description and amount in stock. so I want to do is: every time I place the pointer over the item number to popup a window with the picture of the product.

Is this possible?

Thanks QUILO
 
try this out might be soprt of what you want

put this sub in the workbook object bit
in the activecell line put in your cell values.
create a userform called userform2 but put nothing in it
when you double click on your cell it will display the picture

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
If ActiveCell.Value = "your pic reference" Then

UserForm2.Picture = LoadPicture("c:\your picture file")
UserForm2.Show
Else: End If

If ActiveCell.Value = "your second pic ref." Then

UserForm2.Picture = LoadPicture("C:\your second pic file")
UserForm2.Show
Else: End If


End Sub

hope it helps
Andrew299 It may have hit every branch on its way out of the ugly tree, but hey! It works. (sometimes)
 
You could also use the worksheet_selectionchange event, to get the number of clicks required down to 1. If you really want it to be a hover event, then you need to add objects behind your cell contents and use the mouseover event for the objects. But that's a lot of work...
Rob
[flowerface]
 
Dear andrew299 thanks for the support but I can’t make it work at all. Would you explain me whit more details.
I am kind of new on this, and I do not understand much of VBA and I’m using Excel XP in Spanish

Thanks QUILO
 
Dear andrew299 I finally work it out it was very simple thanks a lot for the tip.
But now how can I apply it for 2,200 different items?
Or how can I make de loop?

Thanks
QUILO
 
you might want to try something like this

replace the if..then bit with

Filename = ActiveCell.Value
userFORM2.Picture = LoadPicture("C:\" & Filename & ".bmp")
userform2.show

you will have to change the filenames of the pictures to whatever you are using in the sheet or visa versa.You have to change to the correct folder as well c:\....
then you only need these two lines instead of all of above (exluding sub and end sub of course)

try it and report back
andrew299 It may have hit every branch on its way out of the ugly tree, but hey! It works. (but don't quote me on that)
 
Dear andrew299 the new way it work just perfect thanks again for the tip
But now I’m stock again with another issue: on the same list of items I have 2,200 item number with their own description but I only have 2,000 pictures at all, when I double click on a item that don’t have a picture it will show a Run-time error ‘53’ that said, picture not found. How can I fix it so if y click on a cell that doesn’t have a picture just ignore the command ?

Thanks Again
QUILO
 
You will probably need to put in a bit of error handling

At the beginning of the code put in'

On error goto errorhandler

..
..
code
..
..

Exit sub 'where the old end sub was

Errorhandler: 'below exit sub

dim style,msg
style=vbcritical
msg = ("No picture is available for this object")
error1=msgbox(msg,style)
end sub


This should fix your problem

Andrew299





It may have hit every branch on its way out of the ugly tree, but hey! It works. (but don't quote me on that)
 
Dear Andrew299 thanks a lot for you help and your time everything work fine
Sorry I didn’t write before.
Thanks Again
QUILO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top