Picture1_click

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.
 
D

Dave Peterson

#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.
 
B

Bobby

#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!
 
G

Gord Dibben

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
 
D

Dave Peterson

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

Next, we'll be discussing that Gordian Knot!
 
G

Gord Dibben

Good recall.

Now, do you remember the name of Alex's horse?

No peeking<g>


Gord
 
B

Bob I

Oh my, seems it was Buceaphus. <spelling is probably wrong as i can't
look it up ;-) )
 
G

Gord Dibben

Only someone with more time than honey-do lists would even bother to ask it.


Gord
 
Top