ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Detecting selection before click (https://www.excelbanter.com/excel-programming/435775-detecting-selection-before-click.html)

mrt

Detecting selection before click
 
Hello,
On a sheet, I have two shapes (say two Ovals) and an ActiveX button. Let's
select one of the two shapes. I want to know when I click on the button, what
shape was selected before the button got activated. I could not find an
answer after searching for a while as there no event such as beforeclick.
Thanks in advance for any help,
MrT

mrt

Detecting selection before click
 
Well, I've just found the answer: you need to set the TakeTheFocus property
to false ...

"MrT" wrote:

Hello,
On a sheet, I have two shapes (say two Ovals) and an ActiveX button. Let's
select one of the two shapes. I want to know when I click on the button, what
shape was selected before the button got activated. I could not find an
answer after searching for a while as there no event such as beforeclick.
Thanks in advance for any help,
MrT


Gary''s Student

Detecting selection before click
 
If you use a Forms button rather than a Controls button:

Sub WhoGotClicked()
MsgBox (Selection.Name)
End Sub

will tell you which Shape got clicked.
--
Gary''s Student - gsnu200908


"MrT" wrote:

Well, I've just found the answer: you need to set the TakeTheFocus property
to false ...

"MrT" wrote:

Hello,
On a sheet, I have two shapes (say two Ovals) and an ActiveX button. Let's
select one of the two shapes. I want to know when I click on the button, what
shape was selected before the button got activated. I could not find an
answer after searching for a while as there no event such as beforeclick.
Thanks in advance for any help,
MrT


mrt

Detecting selection before click
 
The problem of form buttons is that you cannot control many things such as
background color.

"Gary''s Student" wrote:

If you use a Forms button rather than a Controls button:

Sub WhoGotClicked()
MsgBox (Selection.Name)
End Sub

will tell you which Shape got clicked.
--
Gary''s Student - gsnu200908


"MrT" wrote:

Well, I've just found the answer: you need to set the TakeTheFocus property
to false ...

"MrT" wrote:

Hello,
On a sheet, I have two shapes (say two Ovals) and an ActiveX button. Let's
select one of the two shapes. I want to know when I click on the button, what
shape was selected before the button got activated. I could not find an
answer after searching for a while as there no event such as beforeclick.
Thanks in advance for any help,
MrT


Gary''s Student

Detecting selection before click
 
If your interest is in background color, you can assign a macro to any piece
from the Drawing toolbar and assign any color to the shape.

Of course, this ruins your ultimate goal of capturing the shape that got
clicked!
--
Gary''s Student - gsnu200908


"MrT" wrote:

The problem of form buttons is that you cannot control many things such as
background color.

"Gary''s Student" wrote:

If you use a Forms button rather than a Controls button:

Sub WhoGotClicked()
MsgBox (Selection.Name)
End Sub

will tell you which Shape got clicked.
--
Gary''s Student - gsnu200908


"MrT" wrote:

Well, I've just found the answer: you need to set the TakeTheFocus property
to false ...

"MrT" wrote:

Hello,
On a sheet, I have two shapes (say two Ovals) and an ActiveX button. Let's
select one of the two shapes. I want to know when I click on the button, what
shape was selected before the button got activated. I could not find an
answer after searching for a while as there no event such as beforeclick.
Thanks in advance for any help,
MrT



All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com