![]() |
Indexing of Shapes
I need to import GIF images as buttons in my workbook. I then want to control their behaviour in my procedures. To identify these button objects I recorded a micro and saw that they are identified as some Picture No eg. Shapes("Picture15"), shapes("Picture 23"). I have no clue how this picture numbering ( indexing of shapes ) is handled by VBA. One button is Picture17 and other is Picture23. On the face of this it looks very random but I am sure there is some method. Like when we use commandbuttons each button has a name and we can address that by the name. How do I identify GIF used as buttons? I must know the name or some identifier if I want to control the behaviour of the GIF buttons. Pl help. -- avveerkar ------------------------------------------------------------------------ avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338 View this thread: http://www.excelforum.com/showthread...hreadid=503254 |
Indexing of Shapes
You can control the pictures when you insert them:
Option Explicit Sub testme() Dim myPict As Picture Dim myRng As Range With ActiveSheet Set myRng = .Range("b3:c4") Set myPict = .Pictures.Insert("c:\my documents\my pictures\badday.jpg") End With With myPict .Top = myRng.Top .Left = myRng.Left .Width = myRng.Width .Height = myRng.Height .Name = "Pict_" & .TopLeftCell.Address(0, 0) .OnAction = "'" & ThisWorkbook.Name & "'!testme03" End With End Sub Sub testme03() dim myPict as picture MsgBox "you clicked: " & Application.Caller set mypict = activesheet.pictures(application.caller) msgbox mypict.name End Sub avveerkar wrote: I need to import GIF images as buttons in my workbook. I then want to control their behaviour in my procedures. To identify these button objects I recorded a micro and saw that they are identified as some Picture No eg. Shapes("Picture15"), shapes("Picture 23"). I have no clue how this picture numbering ( indexing of shapes ) is handled by VBA. One button is Picture17 and other is Picture23. On the face of this it looks very random but I am sure there is some method. Like when we use commandbuttons each button has a name and we can address that by the name. How do I identify GIF used as buttons? I must know the name or some identifier if I want to control the behaviour of the GIF buttons. Pl help. -- avveerkar ------------------------------------------------------------------------ avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338 View this thread: http://www.excelforum.com/showthread...hreadid=503254 -- Dave Peterson |
Indexing of Shapes
Dear Dave Peterson, Thank you for response. It answers my question very well. A V Veerkar -- avveerkar ------------------------------------------------------------------------ avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338 View this thread: http://www.excelforum.com/showthread...hreadid=503254 |
All times are GMT +1. The time now is 03:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com