Pages

Friday, March 30, 2012

Display Image on Mouseover

If you want to show any image on mouse-over on command button

gif maker
Gif maker


Step 1


Goto Developer Tab -> Insert -> choose label in Active x (add it to the sheet)




Step 2

Goto Developer Tab -> Insert -> choose command button in Active x (add it to the sheet , and paste on the top of label)

Note Labels size should be bigger than command buttons size( You need to paste or add command button over the label)

Step 3

Add a shape which you wanna show on the mouse over and give it some name

For example Mouse_t_1

To change the name of image . Select image and type name in the below box ( left to the forumla tab)





Step 4



Goto label and right click choose property




Goto Worksheet module and add below code to it


Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ActiveSheet.Shapes("Mouse_t_1").Visible = True
End Sub


Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ActiveSheet.Shapes("Mouse_t_1").Visible = False
End Sub



Logic: Label size is bigger than command button and command button is pasted or added over label. When you will keep the mouse on command button it will make the shape visible and when you remove the mouse button the label( mouse over) will make the shape invisible


Download Link

2 comments:

  1. Download Link

    https://docs.google.com/open?id=0B5DIDTPxtXg2WlcxQWZqa0FUbE9TRHRpTmdGN1B5Zw

    ReplyDelete
  2. Hi, thanks for tutorial
    I made button mouse over effect on template.
    https://netmerkez.wordpress.com/excel/button-mouse-over-effect/

    ReplyDelete