Sorry for the rabbit hole...I posted too quickly and once it was sent,
I couldnt retract.

I still can not get it to work.

Latest I tried is this, which always says left click has been pressed

code:

On a module I have:  Public Declare Function GetAsyncKeyState Lib
"user32" (ByVal vKey As Long) As Integer

(some postings change the return type and the parameter types)

In my sheet I have:
Sub Worksheet_SelectionChange(ByVal Target As Range)
If (GetAsyncKeyState(vbKeyRButton)) Then
MsgBox "You have clicked the right button!" 'when you click right
button

ElseIf (GetAsyncKeyState(vbKeyLButton) ) Then
MsgBox "You have clicked the left button!" 'when you click left button
End If


End Sub

I checked out: 
http://itknowledgeexchange.techtarget.com/beyond-excel/back-to-controlling-the-cursor/
and noticed how the author "cheated" when it came to mouse :)

I've added the &H8000 bit mask, but still nothing on the left mouse
click.

On Feb 9, 3:52 am, ashish koul <koul.ash...@gmail.com> wrote:
> hi dave
>
> check this link see if 
> helpshttp://itknowledgeexchange.techtarget.com/beyond-excel/back-to-contro...
>
> On Wed, Feb 9, 2011 at 2:08 PM, Dave Bonallack 
> <davebonall...@hotmail.com>wrote:
>
>
>
>
>
> > Thanks Ashish,
> > Works great.
> > Regards - Dave.
>
> > ------------------------------
> > Date: Wed, 9 Feb 2011 10:32:26 +0530
>
> > Subject: Re: $$Excel-Macros$$ Re: GetAsyncKeyState not working window 7
> > office 2010 x64
> > From: koul.ash...@gmail.com
> > To: excel-macros@googlegroups.com
>
> > try this
>
> > On Wed, Feb 9, 2011 at 10:27 AM, ashish koul <koul.ash...@gmail.com>wrote:
>
> > @ dave Try this
>
> >  Wed, Feb 9, 2011 at 9:55 AM, Dave Bonallack 
> > <davebonall...@hotmail.com>wrote:
>
> > Hi Ashish,
> > Thanks for sending the file. Excellent. But for some reason, selecting a
> > cell with the left mouse button isn't recognised. I tried adding Rob's code,
> > but it didn't work properly either. It only worked when using the left mouse
> > button to 'OK' a previous message box.
> > Regards - Dave
>
> > ------------------------------
> > Date: Wed, 9 Feb 2011 09:03:03 +0530
> > Subject: Re: $$Excel-Macros$$ Re: GetAsyncKeyState not working window 7
> > office 2010 x64
> > From: koul.ash...@gmail.com
>
> > To: excel-macros@googlegroups.com
>
> > hi dave,
>
> > see if this helps
>
> > On Wed, Feb 9, 2011 at 5:52 AM, Dave Bonallack 
> > <davebonall...@hotmail.com>wrote:
>
> > Hi Rob,
> > I am interested in the trapping of a left mouse click, but couldn't
> > understand it from your posts. Could you please attach a workbook
> > with working code?
> > Regards - Dave.
>
> > > Date: Tue, 8 Feb 2011 05:14:53 -0800
> > > Subject: $$Excel-Macros$$ Re: GetAsyncKeyState not working window 7
> > office 2010 x64
> > > From: robert.a.cama...@gmail.com
> > > To: excel-macros@googlegroups.com
>
> > > solved it:
> > > I had to add a bit mask (i think thats what its called).
>
> > > This returned true when I clicked on a cell:
>
> > > If CBool(GetAsyncKeyState(1) & 128) Then
> > > MsgBox ("left click trapped")
> > > End If
>
> > > (1) is the constant for left mouse click
>
> > > On Feb 7, 11:28 am, rcamarda <robert.a.cama...@gmail.com> wrote:
> > > > Hi,
> > > > I am trying to trap a left mouse click. I found lots of uses of
> > > > GetAsyncKeyState, however, even something simple is not working.
>
> > > > Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey
> > > > As Long) As Integer
>
> > > > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
>
> > > > If GetAsyncKeyState(VK_LBUTTON) Then
> > > >     MsgBox ("left click trapped")
> > > > End If
>
> > > > If GetAsyncKeyState(VK_BACK) Then
> > > >     MsgBox ("back space")
> > > > End If
>
> > > > If GetAsyncKeyState(VK_RETURN) Then
> > > >     MsgBox ("enter key")
> > > > End If
>
> > > > End Sub
>
> > > > Should I use a different library when using x64 or Office 2010??
> > > > TIA
> > > > Rob
>
> > > --
>
> > ---------------------------------------------------------------------------­-------
> > > Some important links for excel users:
> > > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > > To post to this group, send email to excel-macros@googlegroups.com
>
> > > <><><><><><><><><><><><><><><><><><><><><><>
> > > Like our page on facebook , Just follow below link
> > >http://www.facebook.com/discussexcel
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/discussexcel
>
> > --
> > *Regards*
> > * *
> > *Ashish Koul*
> > *akoul*.*blogspot*.com <http://akoul.blogspot.com/>
> > *akoul*.wordpress.com <http://akoul.wordpress.com/>
> > My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>
>
> > P Before printing, think about the environment.
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/discussexcel
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/discussexcel
>
> > --
> > *Regards*
> > * *
> > *Ashish Koul*
> > *akoul*.*blogspot*.com <http://akoul.blogspot.com/>
> > *akoul*.wordpress.com <http://akoul.wordpress.com/>
> > My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>
>
> > P Before printing, think about the environment.
>
> > --
> > *Regards*
> > * *
> > *Ashish Koul*
> > *akoul*.*blogspot*.com <http://akoul.blogspot.com/>
> > *akoul*.wordpress.com <http://akoul.wordpress.com/>
> > My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>
>
> > P Before printing, think about the environment.
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/discussexcel
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/discussexcel
>
> --
> *Regards*
> * *
> *Ashish Koul*
> *akoul*.*blogspot*.com <http://akoul.blogspot.com/>
> *akoul*.wordpress.com <http://akoul.wordpress.com/>
> My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>
>
> P Before printing, think about the environment.- Hide quoted text -
>
> - Show quoted text -

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to