Picture1_click

  • Thread starter Thread starter Bobby
  • Start date Start date
B

Bobby

Hi,
I have 2 questions:

1. For my VBA macro, I am looking for the objet name that would tell
me the picture on the sheet that was just click?

2, How can I lock the opposite button on the mouse so the user could
not assgin an other macro or cut, copy etc.?

Thank you.
 
#1.

You can use Application.caller to get the name of the object that was clicked.

Option Explicit
Sub testme()
Dim myPict As Picture

Set myPict = ActiveSheet.Pictures(Application.Caller)

MsgBox myPict.Name & vbLf & myPict.TopLeftCell.Address(0, 0)
End Sub


#2. Protect the worksheet and the user shouldn't be able touch your macro
assignment.
 
#1.

You can use Application.caller to get the name of the object that was clicked.

Option Explicit
Sub testme()
    Dim myPict As Picture

    Set myPict = ActiveSheet.Pictures(Application.Caller)

    MsgBox myPict.Name & vbLf & myPict.TopLeftCell.Address(0, 0)
End Sub

#2.  Protect the worksheet and the user shouldn't be able touch your macro
assignment.

You are the King! Thanks!
 
King David<g>

Wasn't he the dude who lay down with another man's wife then sent the man
out to get whacked in battle?


Gord
 
Hmmm. Two religeous references in the same day (not both by you).

Next, we'll be discussing that Gordian Knot!
 
Oh my, seems it was Buceaphus. <spelling is probably wrong as i can't
look it up ;-) )
 
Back
Top