Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Indexing of Shapes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
avveerkar - 20 Jan 2006 09:13 GMT
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.

Signature

avveerkar

Dave Peterson - 20 Jan 2006 17:57 GMT
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

> 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
[quoted text clipped - 13 lines]
> avveerkar's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30338
> View this thread: http://www.excelforum.com/showthread.php?threadid=503254

Signature

Dave Peterson

avveerkar - 22 Jan 2006 10:44 GMT
Dear Dave Peterson,

Thank you for response. It answers my question very well.

A V Veerkar

Signature

avveerkar

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.