Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Single Click & Double Click on Shapes

  Asked By: Keana    Date: Feb 07    Category: MS Office    Views: 949
  

I have drawn a flow chart on Excel using the drawing tools, certainly
I know how to Assign Macro to the flow chart elements, so clicking an
element once will activate a macro subroutine.

Take it further, I tried to find the way to trigger a second macro
after fast double clicking the flow chart element.

There are doubleclick, dblclick in the VBA library, but still I cannot
find the correct way to work.

Could somebody help me ?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Isabelle Brown     Answered On: Feb 07

The shapes  do not have double-click events. To achieve what you want you
could write a new class object which has a double-click event. This is way
beyond anything I have tried.

OR

You could use the before double-click event of the worksheet and then test
target to find  out where the double-click took place. I think that the target
would be the underlying cell.

 
Answer #2    Answered By: Nagaraju Iyaner     Answered On: Feb 07

I attempted to write this subroutine  which is called when the Shape is
clicked , or called again when the Shape is double  clicked.

Public ClickTime As Integer

Sub DoubClickShape()
Dim PauseTime, Start, Finish, TotalTime as single
Start = Timer
PauseTime = 0.5

If ClickTime >= 1 Then
ClickTime = 2
Else
ClickTime = 1
End If

Do While Timer < Start + PauseTime
DoEvents ' click  the shape again or just don't click anything.
Loop

If ClickTime = 2 Then
MsgBox "Double Click" ' OR other subroutine
ClickTime = 0
End
Else
MsgBox "Single Click" ' OR other subroutine
ClickTime = 0
End If

End Sub

The Sub can work  but it is too slow to capture the double click, so
let me see if I can work out your suggestion.

 
Didn't find what you were looking for? Find more on Single Click & Double Click on Shapes Or get search suggestion and latest updates.




Tagged: