PC Review


Reply
Thread Tools Rate Thread

Change Mouse Pointer Image in Workbook

 
 
RyanH
Guest
Posts: n/a
 
      10th Sep 2008
I have a Worksheet Double Click Event in a particular Workbook. Is there a
way to change the mouse image from a "plus sign" to a typical "arrow"? This
would help to me more precise in double clicking cells.
--
Cheers,
Ryan
 
Reply With Quote
 
 
 
 
Tom Hutchins
Guest
Posts: n/a
 
      10th Sep 2008
The following event macros will make the cursor an arrow whenever the
workbook containing them is active:

Private Sub Workbook_Activate()
Application.Cursor = xlNorthwestArrow
End Sub

Private Sub Workbook_Deactivate()
Application.Cursor = xlDefault
End Sub

Copy & paste these into the ThisWorkbook module of your workbook. If you are
new to macros, this link to Jon Peltier's site may be helpful:
http://peltiertech.com/WordPress/200...e-elses-macro/

Hope this helps,

Hutch

"RyanH" wrote:

> I have a Worksheet Double Click Event in a particular Workbook. Is there a
> way to change the mouse image from a "plus sign" to a typical "arrow"? This
> would help to me more precise in double clicking cells.
> --
> Cheers,
> Ryan

 
Reply With Quote
 
RyanH
Guest
Posts: n/a
 
      11th Sep 2008
It works ok, but two questions.

1.) When I change to the VBE, my cursor doesn't change to the default,
because the workbook I am coding is still active. Is there a way have the
..Cursur = xlNorthwestArrow only when the workbook is the active window? Then
change back to xlDefault when I enter the VBE as the active window.

2.) I wanted to change the cursor to xlNorthwestArrow because I have a
Worksheet Double Click Event. I wanted to improve accuracy of the cursor so
the desired cell could accurately be double clicked. Althought the arrow
cursor does help I still have a small problem. When a user accidentally
double clicks between two cells Excel automatically jumps to the very top or
bottom of the UsedRange in that column. Is there a way to prevent that? I
tried setting Cancel = True in my Worksheet Double Click Event, but it
doesn't seem to work. Any ideas?
--
Cheers,
Ryan


"Tom Hutchins" wrote:

> The following event macros will make the cursor an arrow whenever the
> workbook containing them is active:
>
> Private Sub Workbook_Activate()
> Application.Cursor = xlNorthwestArrow
> End Sub
>
> Private Sub Workbook_Deactivate()
> Application.Cursor = xlDefault
> End Sub
>
> Copy & paste these into the ThisWorkbook module of your workbook. If you are
> new to macros, this link to Jon Peltier's site may be helpful:
> http://peltiertech.com/WordPress/200...e-elses-macro/
>
> Hope this helps,
>
> Hutch
>
> "RyanH" wrote:
>
> > I have a Worksheet Double Click Event in a particular Workbook. Is there a
> > way to change the mouse image from a "plus sign" to a typical "arrow"? This
> > would help to me more precise in double clicking cells.
> > --
> > Cheers,
> > Ryan

 
Reply With Quote
 
Tom Hutchins
Guest
Posts: n/a
 
      11th Sep 2008
1. I don't have an elegant solution for this, but I have a workaround.
Instead of
using WorkBook events, use WorkSheet events:

Private Sub Worksheet_Activate()
Application.Cursor = xlNorthwestArrow
End Sub

Private Sub Worksheet_Deactivate()
Application.Cursor = xlDefault
End Sub

Copy & paste the code above into the code page for each sheet where the
cursor
should be altered this way. Create a Workbook_Open sub like the following in
the
ThisWorkbook module:

Private Sub Workbook_Open()
Sheets("Sheet1").Activate
End Sub

Change Sheet1 to the name of one of the sheets with the Worksheet_Activate
event
code. This is to ensure that the Worksheet_Activate event gets triggered.

None of this, in itself, fixes the VBE cursor problem. When you are in the
VBE, the active window is still the active worksheet, not the VBE. You will
see this if you run the following sub in the VBE:

Sub AAAAA()
MsgBox ActiveWindow.Caption
End Sub

So, the workaround is to have at least one sheet that does NOT have the
cursor-changing event code. Make that the active sheet before you go to the
VBE. You could put it in a macro like this:

Sub GotoVBE()
ThisWorkbook.Sheets("Sheet4").Activate
Application.SendKeys "%{F11}"
End Sub

There may be a slick way (maybe using API calls) to determine when you are
in the VBE. Perhaps one of the MVPs knows, and can enlighten us both.

2. I don't have a solution for this. Double-clicking a cell border doesn't
trigger any events I can identify - not Worksheet_BeforeDoubleClick, and not
Workbook_SheetBeforeDoubleClick. Tell your users to click in the middle of
the cells.

Hope this helps,

Hutch

"RyanH" wrote:

> It works ok, but two questions.
>
> 1.) When I change to the VBE, my cursor doesn't change to the default,
> because the workbook I am coding is still active. Is there a way have the
> .Cursur = xlNorthwestArrow only when the workbook is the active window? Then
> change back to xlDefault when I enter the VBE as the active window.
>
> 2.) I wanted to change the cursor to xlNorthwestArrow because I have a
> Worksheet Double Click Event. I wanted to improve accuracy of the cursor so
> the desired cell could accurately be double clicked. Althought the arrow
> cursor does help I still have a small problem. When a user accidentally
> double clicks between two cells Excel automatically jumps to the very top or
> bottom of the UsedRange in that column. Is there a way to prevent that? I
> tried setting Cancel = True in my Worksheet Double Click Event, but it
> doesn't seem to work. Any ideas?
> --
> Cheers,
> Ryan
>
>
> "Tom Hutchins" wrote:
>
> > The following event macros will make the cursor an arrow whenever the
> > workbook containing them is active:
> >
> > Private Sub Workbook_Activate()
> > Application.Cursor = xlNorthwestArrow
> > End Sub
> >
> > Private Sub Workbook_Deactivate()
> > Application.Cursor = xlDefault
> > End Sub
> >
> > Copy & paste these into the ThisWorkbook module of your workbook. If you are
> > new to macros, this link to Jon Peltier's site may be helpful:
> > http://peltiertech.com/WordPress/200...e-elses-macro/
> >
> > Hope this helps,
> >
> > Hutch
> >
> > "RyanH" wrote:
> >
> > > I have a Worksheet Double Click Event in a particular Workbook. Is there a
> > > way to change the mouse image from a "plus sign" to a typical "arrow"? This
> > > would help to me more precise in double clicking cells.
> > > --
> > > Cheers,
> > > Ryan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I change mouse pointer in Outlook back to default pointer atwstar Microsoft Outlook Discussion 1 10th Aug 2009 03:11 PM
On Mouse Move the mouse pointer fick when using Image Victor Torres Microsoft Access Form Coding 11 26th Apr 2009 05:34 AM
Why does my mouse change to a "pointer" and a cd image? =?Utf-8?B?QmlnRGFkZHk=?= Windows XP Configuration 1 30th Jun 2007 06:56 PM
mouse pointer freezes sporadically, by single left clicking or tapping esc, the mouse pointer is freed up for use only to re-occur within minutes. Banana Windows XP General 2 9th Feb 2006 07:10 AM
Mouse Pointer Change When Running Mouse Over Label Dawn Microsoft Access 0 21st Jul 2003 10:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:44 PM.