+ Reply to Thread
Results 1 to 1 of 1

Mouse Move not captured when button is pushed

Hybrid View

dshj Mouse Move not captured when... 07-31-2013, 09:03 AM
  1. #1
    Registered User
    Join Date
    07-05-2013
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Mouse Move not captured when button is pushed

    Hi All

    I have created a very handy mouse zoom routine for excel charts that makes a selection rectangle follow the mouse and then zooms in on the selected area. Microsoft should have provided this feature long ago, but now I have done it.

    My problem is that, when the mouse button is pressed (as in a drag and drop) my mouse move event sub doesn't fire. It works fine when I release the mouse button. The following code in a class module shows what I have written:

    Public WithEvents EvtChart As Chart
    
    'this event routine is used for the Zoom function
    'if zoom has been initialized, this sub captures the mouse click and calls the zoom functions
    Private Sub EvtChart_MouseDown(ByVal Button As Long, ByVal shift As Long, ByVal X As Long, ByVal Y As Long)
        If Button = 1 Then
            If Zoom = False Then
                Call save_XY(X, Y)
            ElseIf Zoom = True Then
                Call RescaleChart(X, Y)
            End If
        End If
    End Sub
    
    'this event routine is used for the Zoom function
    'this sub captures mouse movement to form the selection rectangle. Right now, it doesn't work when the mouse button is down.
    Private Sub EvtChart_MouseMove(ByVal Button As Long, ByVal shift As Long, ByVal X As Long, ByVal Y As Long)
            If X1 > 0 And Y1 > 0 Then Call ResizeRectangle(X, Y)
    End Sub
    Does anyone understand this problem? I also want to make a pan routine but want to hold the mouse button while dragging.
    Last edited by dshj; 08-16-2013 at 03:19 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA code that looks at which worksheet button was pushed
    By whatsmyname in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-08-2013, 02:39 PM
  2. Move Array in Z Pattern When Highlighted and Button Pushed
    By CIfromBury in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-15-2012, 07:49 PM
  3. Need macro's behavior to depend on button pushed
    By JChandler22 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-29-2010, 11:46 AM
  4. Increment counter so when Button pushed, get new sound message
    By chapimp in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-29-2008, 01:46 PM
  5. [SOLVED] move mouse pointer to a default button(Enter) in messagebox
    By x taol in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2006, 08:20 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1